Separating Components in a Row or Column : BoxLayout « Swing JFC « Java

Separating Components in a Row or Column


import javax.swing.Box;
import javax.swing.BoxLayout;
import javax.swing.JButton;

public class Main {
  public static void main(String[] argv) throws Exception {
    JButton component1 = new JButton();
    JButton component2 = new JButton();
    Box box = new Box(BoxLayout.X_AXIS);



Related examples in the same category

1.Glue spreads the components as far apart as possible.
2.Strut spreads the components apart by a fixed distance
3.Laying Out Components in a Row or Column
4.A vertical box container arranges the components top-to-bottom aligned in their preferred sizes.
5.BoxLayout puts components into a row or into a column
6.BoxLayout: set a rigid area among our components.
7.Align your components in horizontal or vertical layout