Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa Ajax container
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


tamilselvi
container
1 Answer(s)      3 years and 10 months ago
Posted in : Ajax


how to add containers in form


Advertisement
View Answers

February 1, 2011 at 1:09 PM


Hi Friend,

Try this:

import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
class  FormData{

    public static void main(String[] args){
    JFrame f=new JFrame();
    JLabel label1=new JLabel("Name: ");
    JLabel label2=new JLabel("Date Of Birth: ");
    JLabel label3=new JLabel("Address: ");
    JLabel label4=new JLabel("Contact No: ");
    final JTextField text1=new JTextField(20);
    final JTextField text2=new JTextField(20);
    final JTextField text3=new JTextField(20);
    final JTextField text4=new JTextField(20);
    JButton b=new JButton("Save");
        JPanel p=new JPanel(new GridLayout(5,2));
        p.add(label1);
        p.add(text1);
        p.add(label2);
        p.add(text2);
        p.add(label3);
        p.add(text3);
        p.add(label4);
        p.add(text4);
        p.add(b);
        f.add(p);
        f.setVisible(true);
        f.pack();
    }
}

For more information, visit the following :

Swing Tutorials

Thanks



Related Tutorials/Questions & Answers:
servlet container
servlet container  What is servlet container
Java container
Java container  What is a Container in a GUI
Advertisements
java container
java container  Why the container does not support multiple layout managers
servlet container
servlet container  When a client request is sent to the servlet container, how does the container choose which servlet to invoke?   The servlet container determines which servlet to invoke based on the configuration
Flex4 container
Flex4 container   Hi... I have a custom component that is larger than a certain container, and I need it to be centered in that container. Best... the whole Application as the Container in the example, the Component would center
Accordian container
Accordian container  Hi.. How to customize accordian and panel look? Thanks   Ans: You can use the stylesheet or creating custom skin. Custom skin is the only way to make a component or container customize. Thanks
What is Spring IOC Container ?
What is Spring IOC Container ?  Hi, What is Spring IOC Container ? Thanks
Container or Component - Java Beginners
Container or Component  I was asked this question on and am having...) a component is a subclass of a container which means any container can hold a component 2...) a container is a subclass of component which means a container can hold another
Servlet Container
Servlet Container       A servlet container is nothing but a compiled, executable program. The main function of the container is to load, initialize and execute servlets. The servlet container
services provided by a container
services provided by a container  What are the services provided by a container?   The services provided by container are as follows: Transaction management for the bean Security for the bean Persistence of the bean
VDividedBox layout container
VDividedBox layout container       VDividedBox Layout Container is similar to VBox Layout Container... to resize the area of container for the child components using mouse pointer
DividedBox layout container
DividedBox layout container       DividedBox Layout Container is similar to Box Layout Container... to resize the area of container for the child components using mouse pointer. Hold
Canvas Layout Container
Canvas Layout Container       Canvas container is one of the commonly used container in flex. It defines... container is lightweight and good in performance because it does not have
TitleWindow layout container
TitleWindow layout container       TitleWindow container is much like panel container. It provides title bar, border, content area as panel container does. The added features
HDividedBox layout container
HDividedBox layout container       HDividedBox Layout Container is similar to HBox Layout Container... to resize the area of container for the child components using mouse pointer
Web Container
Web Container       A Web application runs within a Web container of a Web server. The Web container... components for the web applications. Apache Tomcat is the web container
Container - add() - Framework
Container - add()  add(Component comp) Appends the specified component to the end of this container. This add method from Container class... c1 from c1. How to handle this situation using add() function from Container
Flex Container
Flex Container      ... component resides in any container. Flex provides several containers to lay child... the child components in tabular format etc. Container can contain visual
Remove Top-Level Container on Runtime
Remove Top-Level Container on Runtime  Remove Top-Level Container on Runtime
EJB container services
EJB container services       The EJB container is a container that deploys EJB automatically when Web Server is started. All of the entity objects live in container during its creation to removal
EJB container services
EJB container services       The EJB container is a container that deploys EJB automatically when Web Server is started. All of the entity objects live in container during its creation to removal
Application container
Application container       Application container is the root container of any flex application. <mx... the starting point of the execution of the application. The application container
Spark Application Container in Flex4
Spark Application Container in flex4: Spark container is define in the spark.components package. The application container is the first container of the spark components. Basically it is layout container. you can start adding
HBox Layout Container
HBox Layout Container       HBox layout container behaves like Box container with horizontal direction. This container lays its children components horizontally. You can see the code
VBox Layout Container
VBox Layout Container       VBox layout container is just like Box container with vertical direction. This container lays its children components vertically. You can see the code below
servlet container - Servlet Interview Questions
servlet container  Where the servlet container presents...; Hi friend, A servlet container is nothing but a compiled, executable program. The main function of the container is to load, initialize and execute
WindowedApplication Container in Flex4
WindowedApplication container in Flex4: The WindowedApplication container is an application container which is use to create Flex applications for AIR. The WindowedApplication container is used in desktop and window based applications
Form Layout Container in Flex4
Form Layout Container in Flex4: The Form Layout container is a MX container. There is no Spark equivalent. Flex uses the Form Layout container for making a Form. The Form container controls the layout of form, required field option
Spark Container in Flex 4
Spark Container in flex4: The container provides content area that contains its child component. The size of the content area is set by the container. If you want to create a application then you require at least one container
EJB Container or EJB Server
EJB Container or EJB Server       An EJB container is nothing but the program that runs on the server and implements the EJB specifications. EJB container provides special type
 

 

 

DMCA.com