container

container

how to add containers in form

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... noticed that using the whole Application as the Container in the example
Accordian container
Accordian container  Hi.. How to customize accordian and panel look? ThanksADS_TO_REPLACE_1   Ans: You can use the stylesheet or creating custom skin. Custom skin is the only way to make a component or container
container
What is Spring IOC Container ?
What is Spring IOC Container ?  Hi, What is Spring IOC Container ? Thanks
ModuleNotFoundError: No module named 'container'
ModuleNotFoundError: No module named 'container'  Hi, My Python... 'container' How to remove the ModuleNotFoundError: No module named 'container' error? Thanks   Hi, In your python environment you
ModuleNotFoundError: No module named 'in-container'
ModuleNotFoundError: No module named 'in-container'  Hi, My Python... 'in-container' How to remove the ModuleNotFoundError: No module named 'in-container' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'container'
ModuleNotFoundError: No module named 'container'  Hi, My Python... 'container' How to remove the ModuleNotFoundError: No module named 'container' error? Thanks   Hi, In your python environment you
ModuleNotFoundError: No module named 'in-container'
ModuleNotFoundError: No module named 'in-container'  Hi, My Python... 'in-container' How to remove the ModuleNotFoundError: No module named 'in-container' error? Thanks   Hi, In your python
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
Artifacts of pluto-container
List of Artifacts of pluto-container maven depenency
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
Remove Top-Level Container on Runtime
Remove Top-Level Container on Runtime  Remove Top-Level Container on Runtime
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
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
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
Version of activemq>activemq-container dependency
List of Version of activemq>activemq-container dependency
Version of dalma>dalma-container dependency
List of Version of dalma>dalma-container dependency
Version of pluto-container>pluto dependency
Version of tomcat>container_util dependency
List of Version of tomcat>container_util dependency
Version of co.paralleluniverse>capsule-container dependency
List of Version of co.paralleluniverse>capsule-container dependency
Version of com.generallycloud>baseio-container dependency
List of Version of com.generallycloud>baseio-container dependency
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
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
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
ModuleNotFoundError: No module named 'biggu-container'
ModuleNotFoundError: No module named 'biggu-container'  Hi, My... named 'biggu-container' How to remove the ModuleNotFoundError: No module named 'biggu-container' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'cmsplugin-container'
ModuleNotFoundError: No module named 'cmsplugin-container'  Hi, My... named 'cmsplugin-container' How to remove the ModuleNotFoundError: No module named 'cmsplugin-container' error? Thanks   Hi
ModuleNotFoundError: No module named 'container_decrypter'
ModuleNotFoundError: No module named 'container_decrypter'  Hi, My... named 'container_decrypter' How to remove the ModuleNotFoundError: No module named 'container_decrypter' error? Thanks   Hi
ModuleNotFoundError: No module named 'container_packing'
ModuleNotFoundError: No module named 'container_packing'  Hi, My... named 'container_packing' How to remove the ModuleNotFoundError: No module named 'container_packing' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'cubicweb-container'
ModuleNotFoundError: No module named 'cubicweb-container'  Hi, My... named 'cubicweb-container' How to remove the ModuleNotFoundError: No module named 'cubicweb-container' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'cubicweb-container'
ModuleNotFoundError: No module named 'cubicweb-container'  Hi, My... named 'cubicweb-container' How to remove the ModuleNotFoundError: No module named 'cubicweb-container' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'pulp-container'
ModuleNotFoundError: No module named 'pulp-container'  Hi, My... named 'pulp-container' How to remove the ModuleNotFoundError: No module named 'pulp-container' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'resource_container'
ModuleNotFoundError: No module named 'resource_container'  Hi, My... named 'resource_container' How to remove the ModuleNotFoundError: No module named 'resource_container' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'service-container'
ModuleNotFoundError: No module named 'service-container'  Hi, My... named 'service-container' How to remove the ModuleNotFoundError: No module named 'service-container' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'toil-container'
ModuleNotFoundError: No module named 'toil-container'  Hi, My... named 'toil-container' How to remove the ModuleNotFoundError: No module named 'toil-container' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'toil-container'
ModuleNotFoundError: No module named 'toil-container'  Hi, My... named 'toil-container' How to remove the ModuleNotFoundError: No module named 'toil-container' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'xcpengine-container'
ModuleNotFoundError: No module named 'xcpengine-container'  Hi, My... named 'xcpengine-container' How to remove the ModuleNotFoundError: No module named 'xcpengine-container' error? Thanks   Hi
ModuleNotFoundError: No module named 'ansible-container'
ModuleNotFoundError: No module named 'ansible-container'  Hi, My... named 'ansible-container' How to remove the ModuleNotFoundError: No module named 'ansible-container' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'biggu-container'
ModuleNotFoundError: No module named 'biggu-container'  Hi, My... named 'biggu-container' How to remove the ModuleNotFoundError: No module named 'biggu-container' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'cmsplugin-container'
ModuleNotFoundError: No module named 'cmsplugin-container'  Hi, My... named 'cmsplugin-container' How to remove the ModuleNotFoundError: No module named 'cmsplugin-container' error? Thanks   Hi
ModuleNotFoundError: No module named 'coffer-container'
ModuleNotFoundError: No module named 'coffer-container'  Hi, My... named 'coffer-container' How to remove the ModuleNotFoundError: No module named 'coffer-container' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'container-check'
ModuleNotFoundError: No module named 'container-check'  Hi, My... named 'container-check' How to remove the ModuleNotFoundError: No module named 'container-check' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'container-hub'
ModuleNotFoundError: No module named 'container-hub'  Hi, My... 'container-hub' How to remove the ModuleNotFoundError: No module named 'container-hub' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'container_packing'
ModuleNotFoundError: No module named 'container_packing'  Hi, My... named 'container_packing' How to remove the ModuleNotFoundError: No module named 'container_packing' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'container-transform'
ModuleNotFoundError: No module named 'container-transform'  Hi, My... named 'container-transform' How to remove the ModuleNotFoundError: No module named 'container-transform' error? Thanks   Hi
ModuleNotFoundError: No module named 'Container-WhooshAlchemyPlus'
ModuleNotFoundError: No module named 'Container-WhooshAlchemyPlus'  ...: No module named 'Container-WhooshAlchemyPlus' How to remove the ModuleNotFoundError: No module named 'Container-WhooshAlchemyPlus' error? Thanks

Ads