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

JPanelcreateVerticalBoxLayout(Component... components)
create Vertical Box Layout
JPanel topPanel = new JPanel();
topPanel.setLayout(new BoxLayout(topPanel, BoxLayout.Y_AXIS));
for (Component component : components) {
    topPanel.add(component);
topPanel.setAlignmentX(Component.LEFT_ALIGNMENT);
return topPanel;
voidexecLoop(JComponent editor)
Addes the given editor to a jframe and halts until it is closed)
execLoop(editor, true);
JPanelhbox(Component[] components, int spacing)
Do a horizontal layout of the given components.
return hbox(new JPanel(), toList(components), spacing);
JPanelmakeVerticalBoxPanel(int margin)
Make a JPanel with a vertical BoxLayout ; set the border to the given margin on all sides.
return makeVerticalBoxPanel(margin, margin, margin, margin);
JComboBoxnewBox(String name, String... items)
new Box
JComboBox<String> box = new JComboBox<>(items);
box.setName(name);
return box;
ComponentnewBoxForComponent(Component c)
Create a box with a coponent aligned to left.
return newBoxForComponent(c, Component.LEFT_ALIGNMENT);
JFrameshow(JComponent comp, String windowName)
show
JFrame frame = new JFrame(windowName);
frame.add(comp, BorderLayout.CENTER);
frame.pack();
frame.setVisible(true);
return frame;
voidshow(JComponent component)
show
JPanel panel = new JPanel();
panel.setLayout(new BorderLayout());
panel.add(component, BorderLayout.CENTER);
showCentered(panel);
JPanelvbox(Component c1, Component c2)
Layout the given components vertically.
return vbox(toList(new Object[] { c1, c2 }));
JPanelxBoxLayoutPanel(Component... components)
Return new JPanel with the specified components laid out in a BoxLayout along the X-axis
return newJPanel(BoxLayout.X_AXIS, components);