JPanel mainPanel = new JPanel(new GridLayout(2, 1, 10, 10)); ...