Alright, like the title says, this should be an easy question but I'm very new to doing gui and I'm having a little problem.
I'm trying to separate my window into 3 bordered sections (horizontal). So far I've got two, however, the one in the middle extends down to the bottom of the window, blocking the bottom section. I'm guessing it has something to do with my use of NORTH, CENTER, and SOUTH? I attached a picture of the window and some of my code, let me know if you need more!
Top section
public NamePanel(){
Dimension size = getPreferredSize();
size.height = 125;
setPreferredSize(size);
//setBorder(BorderFactory.createTitledBorder("Who owes who money?"));
setBorder(BorderFactory.createTitledBorder("Who?"));
JRadioButton button;
setLayout(new GridBagLayout());
GridBagConstraints gc = new GridBagConstraints();
button = new JRadioButton("Bob");
gc.anchor = GridBagConstraints.CENTER;
gc.weightx = 0.5;
gc.weighty = 0.0;
gc.gridx = 1;
gc.gridy = 0;
add(button, gc);
button = new JRadioButton("Sue");
gc.weighty = 0.5;
gc.gridx = 3;
gc.gridy = 0;
add(button, gc);
Middle Section
public ActionsPanel(){
Dimension size = getPreferredSize();
size.height = 75;
setPreferredSize(size);
setBorder(BorderFactory.createTitledBorder("What would you like to do?"));
JRadioButton button;
setLayout(new GridBagLayout());
GridBagConstraints gc = new GridBagConstraints();
button = new JRadioButton("Add");
gc.anchor = GridBagConstraints.NORTH;
gc.weightx = 0.5;
gc.weighty = 0.0;
gc.gridx = 1;
gc.gridy = 0;
add(button, gc);
Bottom Section (hidden in the picture)
public EntryPanel(){
Dimension size = getPreferredSize();
size.height = 75;
setPreferredSize(size);
setBorder(BorderFactory.createTitledBorder("Enter the transaction"));
JLabel why = new JLabel("Why?: ");
JTextField transName = new JTextField(10);
setLayout(new GridBagLayout());
GridBagConstraints gc = new GridBagConstraints();
gc.anchor = GridBagConstraints.SOUTH;
add(transName, gc);