List of usage examples for javax.swing BoxLayout BoxLayout
@ConstructorProperties({ "target", "axis" }) public BoxLayout(Container target, int axis)
From source file:Main.java
public static JPanel boxPanel(int axis) { JPanel p = new JPanel(); p.setLayout(new BoxLayout(p, axis)); return p;/*from w ww .j a v a2 s.co m*/ }
From source file:Main.java
public static JPanel createPageBoxLaidOutPanel() { final JPanel p = new JPanel(); p.setLayout(new BoxLayout(p, BoxLayout.PAGE_AXIS)); return p;// www .ja v a2 s .c om }
From source file:Main.java
public static JPanel createLineBoxLaidOutPanel() { final JPanel p = new JPanel(); p.setLayout(new BoxLayout(p, BoxLayout.LINE_AXIS)); return p;/*from www . ja v a2 s. com*/ }
From source file:Main.java
private static JPanel createLogin() { JPanel p = new JPanel(); p.setLayout(new BoxLayout(p, BoxLayout.Y_AXIS)); JLabel label = new JLabel("login panel."); label.setFont(label.getFont().deriveFont(Font.ITALIC, 24f)); label.setAlignmentX(0.5f);/*from w w w . jav a2 s . co m*/ label.setBorder(new EmptyBorder(0, 20, 0, 20)); p.add(Box.createVerticalStrut(36)); p.add(label); p.add(Box.createVerticalStrut(144)); return p; }
From source file:AlignX.java
private static Container makeIt(String labelChar, float alignment) { JPanel container = new JPanel(); BoxLayout layout = new BoxLayout(container, BoxLayout.Y_AXIS); container.setLayout(layout);/*from w w w . jav a2 s . c o m*/ for (int i = 1; i < 6; i++) { String label = makeLabel(labelChar, i * 2); JButton button = new JButton(label); button.setAlignmentX(alignment); container.add(button); } return container; }
From source file:Main.java
public static JPanel getComponentColumn(JComponent[] components) { JPanel columnPanel = new JPanel(); columnPanel.setLayout(new BoxLayout(columnPanel, BoxLayout.PAGE_AXIS)); for (int i = 0; i < components.length; i++) { components[i].setMinimumSize(new Dimension(components[i].getPreferredSize().width, ROW_HEIGHT)); components[i].setPreferredSize(new Dimension(components[i].getPreferredSize().width, ROW_HEIGHT)); components[i].setMaximumSize(new Dimension(components[i].getPreferredSize().width, ROW_HEIGHT)); components[i].setAlignmentX(JComponent.LEFT_ALIGNMENT); columnPanel.add(components[i]);//from www .j ava 2 s . co m } return columnPanel; }
From source file:Main.java
private static final Component group(final Component[] components, final int axis) { final JPanel panel = new JPanel(); panel.setLayout(new BoxLayout(panel, axis)); for (final Component component : components) { panel.add(component);/*from w w w. j a v a 2 s. c o m*/ } return panel; }
From source file:XAxisAlignY.java
private static Container makeIt(String title, float alignment) { String labels[] = { "--", "--", "--" }; JPanel container = new JPanel(); container.setBorder(BorderFactory.createTitledBorder(title)); BoxLayout layout = new BoxLayout(container, BoxLayout.X_AXIS); container.setLayout(layout);/*from w w w. j a va 2 s. c o m*/ for (int i = 0, n = labels.length; i < n; i++) { JButton button = new JButton(labels[i]); button.setAlignmentY(alignment); container.add(button); } return container; }
From source file:XAxisAlignY.java
private static Container layoutComponents(String title, float alignment) { String labels[] = { "-", "-", "-" }; JPanel container = new JPanel(); container.setBorder(BorderFactory.createTitledBorder(title)); BoxLayout layout = new BoxLayout(container, BoxLayout.X_AXIS); container.setLayout(layout);// w ww . j av a 2 s. co m for (int i = 0, n = labels.length; i < n; i++) { JButton button = new JButton(labels[i]); button.setAlignmentY(alignment); container.add(button); } return container; }
From source file:YAxisAlignX.java
private static Container makeIt(String title, float alignment) { String labels[] = { "--", "----", "--------", "------------" }; JPanel container = new JPanel(); container.setBorder(BorderFactory.createTitledBorder(title)); BoxLayout layout = new BoxLayout(container, BoxLayout.Y_AXIS); container.setLayout(layout);//from w ww . j a va 2 s. c om for (int i = 0, n = labels.length; i < n; i++) { JButton button = new JButton(labels[i]); button.setAlignmentX(alignment); container.add(button); } return container; }