Java Box create vertical box
import java.awt.Dimension; import java.awt.GridLayout; import javax.swing.Box; import javax.swing.JButton; import javax.swing.JCheckBox; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JTextField; public class Main extends JFrame { public Main() { JPanel container = new JPanel(); Box leftBox = Box.createVerticalBox(); Box centerBox = Box.createVerticalBox(); Box innerCenter1 = Box.createHorizontalBox(); Box innerCenter2 = Box.createHorizontalBox(); Box rightBox = Box.createVerticalBox(); JPanel rightGrid = new JPanel(new GridLayout(3, 1, 0, 10)); // LEFT/*from ww w . j ava2 s . c om*/ leftBox.add(new JCheckBox("Snap to Grid")); leftBox.add(new JCheckBox("Show Grid")); // CENTER innerCenter1.add(new JLabel("X: ")); innerCenter1.add(new JTextField(3)); innerCenter2.add(new JLabel("Y: ")); innerCenter2.add(new JTextField(3)); centerBox.add(innerCenter1); centerBox.add(Box.createRigidArea(new Dimension(0, 10))); centerBox.add(innerCenter2); // RIGHT rightGrid.add(new JButton("Ok")); rightGrid.add(new JButton("Cancel")); rightGrid.add(new JButton("Help")); rightBox.add(rightGrid); container.add(leftBox); container.add(Box.createRigidArea(new Dimension(10, 0))); container.add(centerBox); container.add(Box.createRigidArea(new Dimension(10, 0))); container.add(rightBox); add(container); } public static void main(String[] args) { Main gui = new Main(); gui.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); gui.setSize(400, 250); gui.setVisible(true); } }