Example usage for java.awt BorderLayout EAST

List of usage examples for java.awt BorderLayout EAST

Introduction

In this page you can find the example usage for java.awt BorderLayout EAST.

Prototype

String EAST

To view the source code for java.awt BorderLayout EAST.

Click Source Link

Document

The east layout constraint (right side of container).

Usage

From source file:Box1.java

public void init() {
    Box bv = Box.createVerticalBox();
    for (int i = 0; i < 5; i++)
        bv.add(new JButton("bv " + i));
    Box bh = Box.createHorizontalBox();
    for (int i = 0; i < 5; i++)
        bh.add(new JButton("bh " + i));
    Container cp = getContentPane();
    cp.add(BorderLayout.EAST, bv);
    cp.add(BorderLayout.SOUTH, bh);
}

From source file:Main.java

public Main() {
    String[] items = { "Select Item", "Color", "Shape", "Fruit" };
    mainComboBox = new JComboBox(items);
    mainComboBox.addActionListener(this);

    getContentPane().add(mainComboBox, BorderLayout.WEST);

    subComboBox = new JComboBox();
    getContentPane().add(subComboBox, BorderLayout.EAST);

    String[] subItems1 = { "Select Color", "Red", "Blue", "Green" };
    subItems.put(items[1], subItems1);//from  w w w .  j av a  2  s.  co  m

    String[] subItems2 = { "Select Shape", "Circle", "Square", "Triangle" };
    subItems.put(items[2], subItems2);

    String[] subItems3 = { "Select Fruit", "Apple", "Orange", "Banana" };
    subItems.put(items[3], subItems3);
}

From source file:Main.java

public Main() {
    setLayout(new BorderLayout());
    JScrollBar hbar = new JScrollBar(JScrollBar.HORIZONTAL, 30, 20, 0, 300);
    JScrollBar vbar = new JScrollBar(JScrollBar.VERTICAL, 30, 40, 0, 300);
    hbar.setUnitIncrement(2);/*from   w w w .jav  a2  s . co m*/
    hbar.setBlockIncrement(1);

    hbar.addAdjustmentListener(new MyAdjustmentListener());
    vbar.addAdjustmentListener(new MyAdjustmentListener());

    add(hbar, BorderLayout.SOUTH);
    add(vbar, BorderLayout.EAST);
    add(label, BorderLayout.CENTER);
}

From source file:Main.java

public Main() {
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    step.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            int value = bar.getValue() + 7;
            if (value > bar.getMaximum()) {
                value = bar.getMaximum();
            }/*from   ww w .ja v a  2 s. com*/
            bar.setValue(value);
        }
    });

    getContentPane().add(bar, BorderLayout.NORTH);
    getContentPane().add(step, BorderLayout.EAST);
    pack();
    setVisible(true);
}

From source file:MainClass.java

public MainClass() {
    super(true);/*from  w  w w  . ja  v a  2s .  c om*/

    setLayout(new BorderLayout());

    JScrollBar hbar = new JScrollBar(JScrollBar.HORIZONTAL, 30, 20, 0, 300);
    JScrollBar vbar = new JScrollBar(JScrollBar.VERTICAL, 30, 40, 0, 300);

    hbar.setUnitIncrement(2);
    hbar.setBlockIncrement(1);

    hbar.addAdjustmentListener(new MyAdjustmentListener());
    vbar.addAdjustmentListener(new MyAdjustmentListener());

    add(hbar, BorderLayout.SOUTH);
    add(vbar, BorderLayout.EAST);
    add(label, BorderLayout.CENTER);
}

From source file:JProgressBarSetValue.java

public JProgressBarSetValue() {
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    step.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            int value = bar.getValue() + 7;
            if (value > bar.getMaximum()) {
                value = bar.getMaximum();
            }//from   w  w w.j  a  v a 2s .c om
            bar.setValue(value);
        }
    });

    getContentPane().add(bar, BorderLayout.NORTH);
    getContentPane().add(step, BorderLayout.EAST);
    pack();
    setVisible(true);
}

From source file:Box2.java

public void init() {
    Box bv = Box.createVerticalBox();
    for (int i = 0; i < 5; i++) {
        bv.add(new JButton("bv " + i));
        bv.add(Box.createVerticalStrut(i * 10));
    }//from  w w w  .  ja v a 2  s  .co m
    Box bh = Box.createHorizontalBox();
    for (int i = 0; i < 5; i++) {
        bh.add(new JButton("bh " + i));
        bh.add(Box.createHorizontalStrut(i * 10));
    }
    Container cp = getContentPane();
    cp.add(BorderLayout.EAST, bv);
    cp.add(BorderLayout.SOUTH, bh);
}

From source file:Main.java

public Main() {
    panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
    setSize(300, 400);//www.  j  a  v  a 2  s .co  m
    getContentPane().add(panel, BorderLayout.EAST);
    setVisible(true);
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    loadLabel();
}

From source file:Main.java

public Main() {
    textField.addActionListener(e -> {
        comboBox.addItem(textField.getText());
        textField.setText("");
        comboBox.showPopup();/* w  w w . j av a2 s  . c  om*/
    });

    JFrame frame = new JFrame();
    frame.setDefaultCloseOperation(EXIT_ON_CLOSE);
    frame.add(comboBox, BorderLayout.SOUTH);
    frame.add(textField, BorderLayout.WEST);
    frame.add(new JLabel("Enter to add Item  "), BorderLayout.EAST);
    frame.pack();
    frame.setVisible(true);
}

From source file:SwingScrollBarExample.java

public SwingScrollBarExample() {
    super(true);/*w ww . j  a v  a 2 s  .c  o  m*/
    label = new JLabel();
    setLayout(new BorderLayout());

    JScrollBar hbar = new JScrollBar(JScrollBar.HORIZONTAL, 30, 20, 0, 300);
    JScrollBar vbar = new JScrollBar(JScrollBar.VERTICAL, 30, 40, 0, 300);

    hbar.setUnitIncrement(2);
    hbar.setBlockIncrement(1);

    hbar.addAdjustmentListener(new MyAdjustmentListener());
    vbar.addAdjustmentListener(new MyAdjustmentListener());

    add(hbar, BorderLayout.SOUTH);
    add(vbar, BorderLayout.EAST);
    add(label, BorderLayout.CENTER);
}