Example usage for javax.swing JCheckBox setAlignmentY

List of usage examples for javax.swing JCheckBox setAlignmentY

Introduction

In this page you can find the example usage for javax.swing JCheckBox setAlignmentY.

Prototype

@BeanProperty(description = "The preferred vertical alignment of the component.")
public void setAlignmentY(float alignmentY) 

Source Link

Document

Sets the vertical alignment.

Usage

From source file:Main.java

public static void main(String[] args) {
    JPanel panel = new JPanel();
    panel.setLayout(new OverlayLayout(panel));

    JTabbedPane tabbedPane = new JTabbedPane();
    tabbedPane.add("1", new JTextField("one"));
    tabbedPane.add("2", new JTextField("two"));
    tabbedPane.setAlignmentX(1.0f);//from ww w. j a va2s .  c o  m
    tabbedPane.setAlignmentY(0.0f);

    JCheckBox checkBox = new JCheckBox("Add tab");
    checkBox.setOpaque(false);
    checkBox.setAlignmentX(1.0f);
    checkBox.setAlignmentY(0.0f);

    panel.add(checkBox);
    panel.add(tabbedPane);

    JFrame frame = new JFrame();
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.add(panel);
    frame.setSize(400, 100);
    frame.setVisible(true);
}

From source file:Main.java

public static void main(String[] args) {
    JPanel panel = new JPanel();
    panel.setLayout(new OverlayLayout(panel));

    JTabbedPane tabbedPane = new JTabbedPane();
    tabbedPane.add("1", new JTextField("one"));
    tabbedPane.add("2", new JTextField("two"));
    tabbedPane.setAlignmentX(1.0f);/* w w  w . j ava 2s  .c o m*/
    tabbedPane.setAlignmentY(0.0f);

    JCheckBox checkBox = new JCheckBox("Check Me");
    checkBox.setOpaque(false);
    checkBox.setAlignmentX(1.0f);
    checkBox.setAlignmentY(0.0f);

    panel.add(checkBox);
    panel.add(tabbedPane);

    JFrame frame = new JFrame();
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.add(panel);
    frame.setLocationByPlatform(true);
    frame.setSize(400, 100);
    frame.setVisible(true);
}

From source file:gda.util.userOptions.UserOptionsDialog.java

@SuppressWarnings("rawtypes")
private JPanel makePane() {
    JPanel pane = new JPanel();
    pane.setLayout(new BoxLayout(pane, BoxLayout.Y_AXIS));

    Iterator<Map.Entry<String, UserOption>> iter = options.entrySet().iterator();
    while (iter.hasNext()) {
        Map.Entry<String, UserOption> entry = iter.next();
        UserOption option = entry.getValue();
        if (option.defaultValue instanceof Boolean && option.description instanceof String) {
            JCheckBox box = new JCheckBox((String) option.description);
            box.setSelected((Boolean) option.value);
            box.setAlignmentX(Component.LEFT_ALIGNMENT);
            box.setAlignmentY(Component.LEFT_ALIGNMENT);
            components.put(entry.getKey(), box);
            pane.add(box);//w  w w  . j  ava 2s. co m
        }
    }
    return pane;
}