Example usage for java.awt BorderLayout WEST

List of usage examples for java.awt BorderLayout WEST

Introduction

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

Prototype

String WEST

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

Click Source Link

Document

The west layout constraint (left side of container).

Usage

From source file:DoubleColor.java

public static void main(String args[]) {
    JFrame frame = new JFrame("Double Color Choosers");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    JColorChooser left = new JColorChooser();
    left.setDragEnabled(true);//  w  w w .ja v a 2  s .c  om
    frame.add(left, BorderLayout.WEST);
    JColorChooser right = new JColorChooser();
    right.setDragEnabled(true);
    frame.add(right, BorderLayout.EAST);

    frame.pack();
    frame.setVisible(true);
}

From source file:MainClass.java

public static void main(final String args[]) {
    JFrame frame = new JFrame("Double Color Choosers");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    JColorChooser left = new JColorChooser();
    left.setDragEnabled(true);//w w  w.  j  a  v a  2  s  . c o m
    frame.add(left, BorderLayout.WEST);

    JColorChooser right = new JColorChooser();
    right.setDragEnabled(true);
    frame.add(right, BorderLayout.EAST);

    frame.pack();
    frame.setVisible(true);

}

From source file:MainClass.java

public static void main(String args[]) {
    JFrame f = new JFrame("JToggleButton Sample");
    f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    f.add(new JToggleButton("North"), BorderLayout.NORTH);
    f.add(new JToggleButton("East"), BorderLayout.EAST);
    f.add(new JToggleButton("West"), BorderLayout.WEST);
    f.add(new JToggleButton("Center"), BorderLayout.CENTER);
    f.add(new JToggleButton("South"), BorderLayout.SOUTH);
    f.setSize(300, 200);//from ww  w  .ja v  a2  s  . c o  m
    f.setVisible(true);
}

From source file:Main.java

public static void main(String[] args) {
    JFrame frame = new JFrame("JFrame");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    JTextField nameTextField = new JTextField();
    JLabel nameLabel = new JLabel("Name:");
    nameLabel.setDisplayedMnemonic('N');
    nameLabel.setLabelFor(nameTextField);

    frame.add(nameLabel, BorderLayout.WEST);
    frame.add(nameTextField, BorderLayout.CENTER);

    frame.pack();//from www.j  a va  2 s .  com
    frame.setVisible(true);
}

From source file:ToggleButtonSample.java

public static void main(String args[]) {
    JFrame f = new JFrame("JToggleButton Sample");
    f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    Container content = f.getContentPane();
    content.add(new JToggleButton("North"), BorderLayout.NORTH);
    content.add(new JToggleButton("East"), BorderLayout.EAST);
    content.add(new JToggleButton("West"), BorderLayout.WEST);
    content.add(new JToggleButton("Center"), BorderLayout.CENTER);
    content.add(new JToggleButton("South"), BorderLayout.SOUTH);
    f.setSize(300, 200);//from ww w  .j a  v  a2  s. c  o  m
    f.setVisible(true);
}

From source file:Main.java

public static void main(String args[]) {
    JPanel panel = new JPanel(new BorderLayout());
    JLabel label = new JLabel("Name: ");
    label.setDisplayedMnemonic(KeyEvent.VK_N);
    JTextField textField = new JTextField();
    label.setLabelFor(textField);/*ww w  .  ja  va  2s .  c  om*/
    panel.add(label, BorderLayout.WEST);
    panel.add(textField, BorderLayout.CENTER);

    JFrame frame = new JFrame();
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    frame.add(panel, BorderLayout.NORTH);
    frame.add(new JButton("Somewhere Else"), BorderLayout.SOUTH);
    frame.setSize(250, 150);
    frame.setVisible(true);
}

From source file:Main.java

public static void main(String args[]) throws Exception {
    JFrame frame = new JFrame("ProgressBars");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    JProgressBar dJProgressBar = new JProgressBar();
    dJProgressBar.setValue(100);//from w  ww.  ja va2s.  c om
    dJProgressBar.setBorderPainted(false);
    dJProgressBar.setString("Ack");
    dJProgressBar.setStringPainted(true);

    frame.add(dJProgressBar, BorderLayout.WEST);
    frame.setSize(300, 200);
    frame.setVisible(true);
}

From source file:MainClass.java

public static void main(String args[]) throws Exception {
    JFrame frame = new JFrame("ProgressBars");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    JProgressBar dJProgressBar = new JProgressBar(JProgressBar.VERTICAL);
    dJProgressBar.setValue(100);/*from w w w  .jav a2  s  .  c  o  m*/
    dJProgressBar.setBorderPainted(false);
    dJProgressBar.setString("Ack");
    dJProgressBar.setStringPainted(true);

    frame.add(dJProgressBar, BorderLayout.WEST);
    frame.setSize(300, 200);
    frame.setVisible(true);
}

From source file:Main.java

public static void main(String args[]) {
    JFrame frame = new JFrame("Label Focus Example");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    JLabel label = new JLabel("Name: ");
    label.setDisplayedMnemonic(KeyEvent.VK_N);

    JTextField textField = new JTextField();
    label.setLabelFor(textField);/* ww  w  .  j av a  2s . com*/

    frame.add(label, BorderLayout.WEST);
    frame.add(textField, BorderLayout.CENTER);

    frame.add(new JButton("Somewhere Else"), BorderLayout.SOUTH);
    frame.setSize(250, 100);
    frame.setVisible(true);
}

From source file:Main.java

public static void main(String args[]) throws Exception {
    JPanel panel = new JPanel(new BorderLayout());
    JLabel label = new JLabel("Name: ");
    label.setDisplayedMnemonic(KeyEvent.VK_N);
    JTextField textField = new JTextField();
    label.setLabelFor(textField);// w w  w .j  ava  2s . co  m
    panel.add(label, BorderLayout.WEST);
    panel.add(textField, BorderLayout.CENTER);

    JFrame frame = new JFrame();
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.add(panel, BorderLayout.NORTH);
    frame.add(new JButton("Somewhere Else"), BorderLayout.SOUTH);
    frame.setSize(250, 150);
    frame.setVisible(true);

    textField.setText("your text");
    String filename = "test.txt";

    FileWriter writer = new FileWriter(filename);
    textField.write(writer);
    writer.close();

}