List of utility methods to do Swing BoxLayout
JPanel | createVerticalBoxLayout(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; |
void | execLoop(JComponent editor) Addes the given editor to a jframe and halts until it is closed) execLoop(editor, true); |
JPanel | hbox(Component[] components, int spacing) Do a horizontal layout of the given components. return hbox(new JPanel(), toList(components), spacing); |
JPanel | makeVerticalBoxPanel(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);
|
JComboBox | newBox(String name, String... items) new Box JComboBox<String> box = new JComboBox<>(items); box.setName(name); return box; |
Component | newBoxForComponent(Component c) Create a box with a coponent aligned to left. return newBoxForComponent(c, Component.LEFT_ALIGNMENT);
|
JFrame | show(JComponent comp, String windowName) show JFrame frame = new JFrame(windowName); frame.add(comp, BorderLayout.CENTER); frame.pack(); frame.setVisible(true); return frame; |
void | show(JComponent component) show JPanel panel = new JPanel(); panel.setLayout(new BorderLayout()); panel.add(component, BorderLayout.CENTER); showCentered(panel); |
JPanel | vbox(Component c1, Component c2) Layout the given components vertically. return vbox(toList(new Object[] { c1, c2 })); |
JPanel | xBoxLayoutPanel(Component... components) Return new JPanel with the specified components laid out in a BoxLayout along the X-axis return newJPanel(BoxLayout.X_AXIS, components);
|