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:
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);
Huh!! Nothing different. Please post me the correct one by indicating the incorrect ones..
Ads