Java AWT BorderLayout add to top and bottom
import java.awt.BorderLayout; import javax.swing.JButton; import javax.swing.JCheckBox; import javax.swing.JComboBox; import javax.swing.JFrame; import javax.swing.JPanel; public class Main extends JFrame { private static final String[] names = { "Red", "Green", "Blue", "Purple", "Greenish" }; public Main() { setLayout(new BorderLayout(5, 5)); JPanel center = new JPanel(); JPanel bottom = new JPanel(); add(new JComboBox(names), BorderLayout.NORTH); center.add(new JCheckBox("Background")); center.add(new JCheckBox("Foreground")); add(center, BorderLayout.CENTER); bottom.add(new JButton("Ok")); bottom.add(new JButton("Cancel")); add(bottom, BorderLayout.SOUTH); }/*from w w w. j a va 2s . c om*/ public static void main(String[] args) { Main gui = new Main(); gui.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); gui.setSize(400, 125); gui.setVisible(true); } }