public static void alignLeft(JComponent box) { for(Component comp: box.getComponents()) { ((JComponent) comp).setAlignmentX(Box.LEFT_ALIGNMENT); } }
this.component.setAlignmentX(this.alignment); this.component.setAlignmentY(0.0f); } else if (this.edge == Edge.BOTTOM) { this.borderInsets.bottom = this.component.getPreferredSize().height + this.gap; this.component.setAlignmentX(this.alignment); this.component.setAlignmentY(1.0f); } else if (this.edge == Edge.LEFT) { this.borderInsets.left = this.component.getPreferredSize().width + this.gap; this.component.setAlignmentX(0.0f); this.component.setAlignmentY(this.alignment); } else if (this.edge == Edge.RIGHT) { this.borderInsets.right = this.component.getPreferredSize().width + this.gap; this.component.setAlignmentX(1.0f); this.component.setAlignmentY(this.alignment);
newButton.setAlignmentX(0.5f);
setAlignmentX(Component.CENTER_ALIGNMENT); setFont(new Font("Arial", Font.PLAIN, 280)); setBorder(new TitledBorder(TITLE){
box.setAlignmentX(JComponent.CENTER_ALIGNMENT); box.add(Box.createVerticalGlue()); box.add(new CustomComponents12());
public Component add(Component comp) { ((JComponent) comp).setAlignmentX(0f); return super.add(comp); } }
/** * Aligns the given component on the left and adds it to this panel. */ @Override public Component add(Component comp) { if(comp instanceof JComponent) ((JComponent)comp).setAlignmentX(LEFT_ALIGNMENT); return super.add(comp); }
/** * Aligns the given component on the left and adds it to this panel. */ @Override public Component add(Component comp) { if(comp instanceof JComponent) ((JComponent)comp).setAlignmentX(LEFT_ALIGNMENT); return super.add(comp); }
private static JPanel createPresetsPanel(Action[] actions) { JPanel rightPanel = new JPanel(); rightPanel.setLayout(new BoxLayout(rightPanel, BoxLayout.Y_AXIS)); rightPanel.setBorder(createTitledBorder("Presets")); for (Action action : actions) { JComponent b = new JButton(action); b.setAlignmentX(Component.LEFT_ALIGNMENT); rightPanel.add(b); } return rightPanel; } }
public static void alignLeft(JComponent box) { for(Component comp: box.getComponents()) { ((JComponent) comp).setAlignmentX(Box.LEFT_ALIGNMENT); } }
public static void addAligned(final Container container, final JComponent component) { component.setAlignmentX(Component.LEFT_ALIGNMENT); component.setAlignmentY(Component.TOP_ALIGNMENT); container.add(component); }
public class CenteringPanel { public CenteringPanel(JComponent child) { setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); GridBagConstraints c = new GridBagConstraints(); child.setMaximumSize(child.getPreferredSize()); child.setAlignmentX(Component.CENTER_ALIGNMENT); add(Box.createVerticalGlue()); add(child); add(Box.createVerticalGlue()); } }
public void addLabeledV( JComponent target , String text , JPanel owner ) { JLabel label = new JLabel(text); label.setLabelFor(target); target.setAlignmentX(Component.CENTER_ALIGNMENT); label.setAlignmentX(Component.CENTER_ALIGNMENT); JPanel p = new JPanel(); p.setLayout(new BoxLayout(p, BoxLayout.Y_AXIS)); p.add(label); p.add(target); owner.add(p); }
private JComponent createPane(String title, int orientation) { JComponent c = new Box(orientation){ public Dimension getMaximumSize() { return new Dimension(super.getMaximumSize().width, getPreferredSize().height); } }; c.setAlignmentX(0.0f); if (title != null){ c.setBorder(ComponentFactory.createTitledBorder(title)); } return c; }
private JComponent createPane(String title, int orientation) { JComponent c = new Box(orientation){ public Dimension getMaximumSize() { return new Dimension(super.getMaximumSize().width, getPreferredSize().height); } }; c.setAlignmentX(0.0f); if (title != null){ c.setBorder(ComponentFactory.createTitledBorder(title)); } return c; }
public static void addLabeledV( JComponent target , String text , JPanel owner ) { JLabel label = new JLabel(text); label.setLabelFor(target); target.setAlignmentX(Component.CENTER_ALIGNMENT); label.setAlignmentX(Component.CENTER_ALIGNMENT); JPanel p = new JPanel(); p.setLayout(new BoxLayout(p, BoxLayout.Y_AXIS)); p.add(label); p.add(target); owner.add(p); }
public void addCommandBar(JComponent component) { component.setBorder(new BasicBorders.MenuBarBorder(Color.GRAY, Color.GRAY)); component.setAlignmentX(Component.BOTTOM_ALIGNMENT); commandBarPanel.add(component); commandBarPanel.invalidate(); }
/** * Add any applet sub-panel(s) now. */ public boolean addSubPanels(Container parent) { JComponent topPane = new ItinScreen(this, null); topPane.setAlignmentX(Component.LEFT_ALIGNMENT); topPane.setAlignmentY(Component.BOTTOM_ALIGNMENT); parent.add(topPane); return true; } /**
public void init(VDialogWindow dialog, DialogAnswerListener answerListener, JComponent content, String[] options) { content.setAlignmentX(0.5f); add(content); add(Box.createGlue()); add(createButtonPanel(dialog, DialogType.CUSTOM, answerListener, options)); } }
public void init(VDialogWindow dialog, DialogAnswerListener answerListener, JComponent content, DialogType type) { content.setAlignmentX(0.5f); add(content); add(Box.createGlue()); add(createButtonPanel(dialog, type, answerListener)); }