Why is the items component not attached to the bottom of the previous line?
public static void main(String[] args) { JFrame frame = new JFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JTextField name = new JTextField("Name"); JButton submit = new JButton("Search"); JScrollPane items = new JScrollPane(); items.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED); items.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); frame.setLayout(new GridBagLayout()); frame.add(name, new GridBagConstraints (0, 0, 1, 1, 2, 1, GridBagConstraints.NORTHEAST, GridBagConstraints.HORIZONTAL,new Insets(5, 2, 2, 2),0,0)); frame.add(submit, new GridBagConstraints(-1, 0, 1, 1, 1, 1, GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL,new Insets(0, 0, 0, 0),0,0)); frame.add(items, new GridBagConstraints (0, -1, 2, 1, -1, 2, GridBagConstraints.NORTH, GridBagConstraints.BOTH,new Insets(0, 0, 0, 0),0,0)); frame.setPreferredSize(new Dimension(800, 600)); // frame.setResizable(false); frame.pack(); frame.setVisible(true); } 