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



Home Answers Viewqa Java-Beginners HOW TO DISPLAY COMPONENTS ROW BY ROW AS A FORM? I want the below program to be modified so that i can get my java application to look like an entry form.. Please help me..
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


dineshkumar
HOW TO DISPLAY COMPONENTS ROW BY ROW AS A FORM? I want the below program to be modified so that i can get my java application to look like an entry form.. Please help me..
2 Answer(s)      2 years ago
Posted in : Java Beginners


    JFrame main=new JFrame("Home-THE SECURED PARKING SERVICE MAIN PAGE");
    main.getContentPane().setBackground(Color.blue);

    JPanel titlePanel=new JPanel();
    JLabel heading=new JLabel("*******THE SECURED PARKING SERVICES*******",JLabel.CENTER);
    heading.setOpaque(true);![alt text][1]
    heading.setBackground(Color.orange);
    heading.setForeground(Color.black);
    heading.setFont(new Font("Serif", Font.BOLD, 35));
    titlePanel.setBackground(Color.blue);
    titlePanel.add(heading);
    //entrypanel and textfields

    JPanel entryPanel=new JPanel();
    entryPanel.setLayout(new BoxLayout(entryPanel,BoxLayout.Y_AXIS));
    JTextField name=new JTextField(10);
    name.setBounds(0, 0, 20, 50);   
    JTextField custid=new JTextField(10);
    JTextField address=new JTextField(10);
    JTextField dob=new JTextField(10);
    JTextField vehiclename=new JTextField(10);
    JTextField vehiclereg_no=new JTextField(10);
    JTextField license_no=new JTextField(10);
    entryPanel.add(name);
    entryPanel.add(custid);
    entryPanel.add(address);
    entryPanel.add(dob);
    entryPanel.add(vehiclename);
    entryPanel.add(vehiclereg_no);
    entryPanel.add(license_no);![alt text][2]
    main.add(titlePanel);
    main.add(entryPanel);
    main.setLayout(new BoxLayout(main.getContentPane(),BoxLayout.Y_AXIS));
    main.setSize(1368,770);//exact window size
    main.setVisible(true);
    main.setDefaultCloseOperation(main.EXIT_ON_CLOSE);

My output is like this:


Advertisement
View Answers

September 3, 2012 at 4:19 PM


We have modified your code. Here it is:

JFrame main=new JFrame("Home-THE SECURED PARKING SERVICE MAIN PAGE");
    main.getContentPane().setBackground(Color.blue);

    JPanel titlePanel=new JPanel();
    JLabel heading=new JLabel("*******THE SECURED PARKING SERVICES*******",JLabel.CENTER);
    heading.setOpaque(true);
    heading.setBackground(Color.orange);
    heading.setForeground(Color.black);
    heading.setFont(new Font("Serif", Font.BOLD, 35));
    titlePanel.setBackground(Color.blue);
    titlePanel.add(heading);
    //entrypanel and textfields

    JPanel entryPanel=new JPanel();
    entryPanel.setLayout(new BoxLayout(entryPanel,BoxLayout.Y_AXIS));
    JTextField name=new JTextField(10);
    name.setBounds(0, 0, 20, 50);   
    JTextField custid=new JTextField(10);
    JTextField address=new JTextField(10);
    JTextField dob=new JTextField(10);
    JTextField vehiclename=new JTextField(10);
    JTextField vehiclereg_no=new JTextField(10);
    JTextField license_no=new JTextField(10);
    entryPanel.add(name);
    entryPanel.add(custid);
    entryPanel.add(address);
    entryPanel.add(dob);
    entryPanel.add(vehiclename);
    entryPanel.add(vehiclereg_no);
    entryPanel.add(license_no);
    main.add(titlePanel);
    main.add(entryPanel);
    main.setLayout(new BoxLayout(main.getContentPane(),BoxLayout.Y_AXIS));
    main.setSize(1368,770);//exact window size
    main.setVisible(true);
    main.setDefaultCloseOperation(main.EXIT_ON_CLOSE);


September 5, 2012 at 4:56 PM


Huh!! Nothing different. Please post me the correct one by indicating the incorrect ones..



Related Tutorials/Questions & Answers:
Advertisements
Advertisements
 

 

 

DMCA.com