Java Utililty Methods Swing BoxLayout

List of utility methods to do Swing BoxLayout

Description

The list of methods to do Swing BoxLayout are organized into topic(s).

Method

voidapplyVerticalBoxLayout(Container p)
apply Vertical Box Layout
p.setLayout(new BoxLayout(p, BoxLayout.Y_AXIS));
JPanelcombineInNorth(JComponent[] components)
Creates a panel that contains all of the components on top of each other in north, and tries to make them as small as possible (probably by using getPreferredSize()).
JPanel result = new JPanel();
if (components.length == 0) {
    return result;
result.setLayout(new BorderLayout());
JPanel contentPanel = new JPanel();
result.add(contentPanel, BorderLayout.NORTH);
contentPanel.setLayout(new GridBagLayout());
...
JPanelcreateBox(Component center, Component north, Component south, Component west, Component east)
create Box
return createBox(null, center, north, south, west, east);
BoxcreateBox(int axis, Object... children)
create Box
if (axis != BoxLayout.X_AXIS && axis != BoxLayout.Y_AXIS)
    throw new IllegalArgumentException();
boolean horizontal = (axis == BoxLayout.X_AXIS);
Box box = new Box(axis);
for (Object child : children) {
    if (child instanceof Component) {
        box.add((Component) child);
    } else if (child instanceof Dimension) {
...
JComponentcreateBox(int orientation, JComponent... components)
create Box
Box box;
if (orientation == 0) {
    box = Box.createHorizontalBox();
} else {
    box = Box.createVerticalBox();
int num = components.length;
for (int i = 0; i < num; i++) {
...
ComponentcreateBoxFiller()
create Box Filler
Dimension min = new Dimension(0, 0);
Dimension max = new Dimension(Integer.MAX_VALUE, Integer.MAX_VALUE);
return new Box.Filler(min, min, max);
BoxLayoutcreateBoxLayout(Container container, int axis, Component... components)
create Box Layout
BoxLayout layout = new BoxLayout(container, axis);
for (Component comp : components) {
    container.add(comp);
return layout;
JPanelcreateBoxLayoutPanel(boolean vertical)
create Box Layout Panel
JPanel panel = new JPanel();
BoxLayout layout = new BoxLayout(panel, vertical ? BoxLayout.Y_AXIS : BoxLayout.X_AXIS);
panel.setLayout(layout);
return panel;
JPanelcreateBoxPanel(int axis)
Creates a new JPanel with a BoxLayout.
JPanel panel = new JPanel();
panel.setLayout(new BoxLayout(panel, axis));
return panel;
JPanelcreateBoxPanel(int orientation)
Create a chartPanel with a box layout with the specified orientation.
JPanel panel = new JPanel();
panel.setLayout(new BoxLayout(panel, orientation));
return panel;