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

JPanelcreateHorizontalBox(int[] ratios, Component... comps)
create Horizontal Box
JPanel panel = new JPanel(new GridBagLayout());
GridBagConstraints c = new GridBagConstraints();
c.gridx = GridBagConstraints.RELATIVE;
c.gridy = 0;
c.fill = GridBagConstraints.BOTH;
for (int i = 0; i < comps.length; i++) {
    Component comp = comps[i];
    if (comp == null)
...
JPanelcreateHorizontalBoxLayout(Component... components)
create Horizontal Box Layout
JPanel ret = new JPanel();
BoxLayout layout = new BoxLayout(ret, BoxLayout.X_AXIS);
ret.setLayout(layout);
for (Component component : components) {
    ret.add(component);
ret.setAlignmentX(Component.LEFT_ALIGNMENT);
return ret;
...
JComponentcreateNorthPanel(JComponent p)
create North Panel
JPanel panel = new JPanel();
panel.setLayout(new BorderLayout());
panel.add(p, BorderLayout.NORTH);
return panel;
JPanelcreatePanelBoxLayout(Component... components)
create Panel Box Layout
int axis = BoxLayout.X_AXIS;
return createPanelBoxLayout(axis, components);
JPanelcreatePanelWithBoxLayout()
create Panel With Box Layout
final JPanel mainPanel = new JPanel();
final BoxLayout layout = new BoxLayout(mainPanel, BoxLayout.Y_AXIS);
mainPanel.setLayout(layout);
return mainPanel;
JComponentcreateTitledPanel(JComponent component, String title)
create Titled Panel
JPanel p = new JPanel();
p.setLayout(new BorderLayout());
p.setBorder(BorderFactory.createTitledBorder(title));
p.add(component, BorderLayout.CENTER);
return p;
JComponentcreateTopAndCenter(JComponent top, JComponent center)
create Top And Center
JPanel result = new JPanel(new BorderLayout());
top.setAlignmentX(Component.LEFT_ALIGNMENT);
result.add(top, BorderLayout.NORTH);
JPanel planePageWrapper = new JPanel(new BorderLayout());
planePageWrapper.setBorder(BorderFactory.createEmptyBorder(15, 0, 5, 0));
center.setAlignmentX(Component.LEFT_ALIGNMENT);
planePageWrapper.add(center, BorderLayout.NORTH);
result.add(planePageWrapper, BorderLayout.CENTER);
...
BoxcreateVertBox(Component... comps)
create Vert Box
return createBox(BoxLayout.PAGE_AXIS, comps);
JPanelcreateVerticalBox(Component... comps)
create Vertical Box
return createVerticalBox((int[]) null, comps);
BoxcreateVerticalBox(Component... cs)
create Vertical Box
Box box = Box.createVerticalBox();
for (Component c : cs)
    box.add(c);
return box;