List of utility methods to do Swing BoxLayout
void | applyVerticalBoxLayout(Container p) apply Vertical Box Layout p.setLayout(new BoxLayout(p, BoxLayout.Y_AXIS));
|
JPanel | combineInNorth(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()); ... |
JPanel | createBox(Component center, Component north, Component south, Component west, Component east) create Box return createBox(null, center, north, south, west, east);
|
Box | createBox(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) { ... |
JComponent | createBox(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++) { ... |
Component | createBoxFiller() 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); |
BoxLayout | createBoxLayout(Container container, int axis, Component... components) create Box Layout BoxLayout layout = new BoxLayout(container, axis); for (Component comp : components) { container.add(comp); return layout; |
JPanel | createBoxLayoutPanel(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; |
JPanel | createBoxPanel(int axis) Creates a new JPanel with a BoxLayout. JPanel panel = new JPanel(); panel.setLayout(new BoxLayout(panel, axis)); return panel; |
JPanel | createBoxPanel(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; |