Cant work out how to layout, can any one help, when I try to resize or put the JComponents in specific places i.e. right of label does not work can any one help.
I have put some code up
thank you for your time
//Additional Information
public void createPage4()
{
panel4 = new JPanel();
panel4.setLayout(new GridLayout(8,8));
GridBagConstraints con = new GridBagConstraints(); // create a new constraints object
label = new JLabel("Any Additional Information:", JLabel.LEFT); // create label
con.gridwidth = 3; // set the width of the grid to 3 grids
con.gridx = 0; // places component at grid
con.gridy = 0; // reference (0,0 )
con.weightx = 0.5; // sets the weigh to 0.5
panel4.add(label);
label1 = new JLabel("Question One:", JLabel.LEFT); // create label1
con.gridwidth = 3; // set the width of the grid to 3 grids
con.gridx = 2; // places component at grid
con.gridy = 0; // reference (0,0 )
con.weightx = 0.5; // sets the weigh to 0.5
panel4.add(label1);
q = new JTextField("A Text Field");
con.gridx = 0;
con.gridy = 2;
con.gridwidth = 1; // sets the gridwidth back from 3 to 1
con.insets = new Insets(20, 20, 20, 20); // create the insets ie the spacing between components to 20 at each side
panel4.add(q, con); // adds field to the cpntainer using the specified constraints
label2 = new JLabel("Question Two:", JLabel.LEFT); // create label2
con.gridwidth = 3; // set the width of the grid to 3 grids
con.gridx = 4; // places component at grid
con.gridy = 0; // reference (0,0 )
con.weightx = 0.5; // sets the weigh to 0.5
panel4.add(label2);
q1 = new JTextField("A Text Field");
con.gridx = 0;
con.gridy = 2;
con.gridwidth = 1; // sets the gridwidth back from 3 to 1
con.insets = new Insets(20, 20, 20, 20); // create the insets ie the spacing between components to 20 at each side
panel4.add(q1, con); // adds field to the cpntainer using the specified constraints
label3 = new JLabel("Question Three:", JLabel.LEFT); // create label3
con.gridwidth = 3; // set the width of the grid to 3 grids
con.gridx = 6; // places component at grid
con.gridy = 0; // reference (0,0 )
con.weightx = 0.5; // sets the weigh to 0.5
panel4.add(label3);
q2 = new JTextField("A Text Field");
con.gridx = 0;
con.gridy = 2;
con.gridwidth = 1; // sets the gridwidth back from 3 to 1
con.insets = new Insets(20, 20, 20, 20); // create the insets ie the spacing between components to 20 at each side
panel4.add(q2, con); // adds field to the cpntainer using the specified constraints
//update1 = new JButton("Update Records"); // creates a new button component
// con.gridwidth = 3;
// con.gridx = 1;
// con.gridy = 0;
// panel4.add(update1, con); // adds button
update1 = new JButton ("Enter");
con.gridx=0;
con.gridy=3;
con.weighty=1;
panel4.add(update1, con);
}