List of utility methods to do Swing BoxLayout
JPanel | createHorizontalBox(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) ... |
JPanel | createHorizontalBoxLayout(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; ... |
JComponent | createNorthPanel(JComponent p) create North Panel JPanel panel = new JPanel(); panel.setLayout(new BorderLayout()); panel.add(p, BorderLayout.NORTH); return panel; |
JPanel | createPanelBoxLayout(Component... components) create Panel Box Layout int axis = BoxLayout.X_AXIS; return createPanelBoxLayout(axis, components); |
JPanel | createPanelWithBoxLayout() create Panel With Box Layout final JPanel mainPanel = new JPanel(); final BoxLayout layout = new BoxLayout(mainPanel, BoxLayout.Y_AXIS); mainPanel.setLayout(layout); return mainPanel; |
JComponent | createTitledPanel(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; |
JComponent | createTopAndCenter(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); ... |
Box | createVertBox(Component... comps) create Vert Box return createBox(BoxLayout.PAGE_AXIS, comps);
|
JPanel | createVerticalBox(Component... comps) create Vertical Box return createVerticalBox((int[]) null, comps); |
Box | createVerticalBox(Component... cs) create Vertical Box Box box = Box.createVerticalBox(); for (Component c : cs) box.add(c); return box; |