Example usage for java.awt BorderLayout NORTH

List of usage examples for java.awt BorderLayout NORTH

Introduction

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

Prototype

String NORTH

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

Click Source Link

Document

The north layout constraint (top of container).

Usage

From source file:Main.java

public static void main(String[] a) {
    JFrame frame = new JFrame("Selecting CheckBox");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    JCheckBox checkBox = new JCheckBox("Hi");

    checkBox.getModel().setRollover(true);

    frame.add(checkBox, BorderLayout.NORTH);
    frame.setSize(300, 100);//w w  w  .  j a v a 2s.c o m
    frame.setVisible(true);
}

From source file:Main.java

public static void main(String[] a) {
    JFrame frame = new JFrame("Selecting CheckBox");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    JCheckBox checkBox = new JCheckBox("Hi");

    checkBox.getModel().setEnabled(false);

    frame.add(checkBox, BorderLayout.NORTH);
    frame.setSize(300, 100);/*from w w w. java 2s .c o  m*/
    frame.setVisible(true);
}

From source file:Main.java

public static void main(String[] a) {
    JFrame frame = new JFrame("Selecting CheckBox");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    JCheckBox checkBox = new JCheckBox("Hi");

    checkBox.getModel().setActionCommand("Hi");

    frame.add(checkBox, BorderLayout.NORTH);
    frame.setSize(300, 100);//from   ww w  . ja  v a2  s. c o  m
    frame.setVisible(true);
}

From source file:Main.java

public static void main(String[] a) {
    JFrame frame = new JFrame("Selecting CheckBox");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    JCheckBox checkBox = new JCheckBox("Hi");

    checkBox.getModel().setMnemonic((char) 'H');

    frame.add(checkBox, BorderLayout.NORTH);
    frame.setSize(300, 100);//from  w  w w.  java  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   w w  w .j  a  va2s  .c  om*/
    f.setVisible(true);
}

From source file:Main.java

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

    JProgressBar aJProgressBar = new JProgressBar();
    aJProgressBar.setIndeterminate(true);
    frame.add(aJProgressBar, BorderLayout.NORTH);
    frame.setSize(300, 100);//ww w  .  java2  s. c  o  m
    frame.setVisible(true);
}

From source file:BoundedRangeModelInJSlider.java

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

    JSlider oneJSlider = new JSlider();

    System.out.println(oneJSlider.getModel().getMaximum());

    frame.add(oneJSlider, BorderLayout.NORTH);

    frame.setSize(300, 200);/* w ww.  j  a v a 2s  .co m*/
    frame.setVisible(true);
}

From source file:FormattedTest.java

public static void main(String args[]) {
    JFrame frame = new JFrame("Formatted");
    Container contentPane = frame.getContentPane();
    JFormattedTextField ftf1 = new JFormattedTextField(new Integer(0));
    contentPane.add(ftf1, BorderLayout.NORTH);
    JFormattedTextField ftf2 = new JFormattedTextField(new Date());
    contentPane.add(ftf2, BorderLayout.SOUTH);
    frame.setSize(200, 100);/*from  w  w w  . jav a2  s. c  o  m*/
    frame.show();
}

From source file:Main.java

public static void main(String[] args) {
    JFrame frame = new JFrame("test");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    JPanel panel = new JPanel(new BorderLayout());
    JPanel panel2 = new JPanel(new BorderLayout());
    panel2.add(new JButton("NORTH"), BorderLayout.NORTH);
    panel2.add(new JButton("CENTER"));
    panel.add(panel2);//from   w  ww.  j  a v a 2  s  . c  o m
    panel.add(new JButton("SOUTH"), BorderLayout.SOUTH);
    panel.add(new JButton("EAST"), BorderLayout.EAST);
    frame.add(panel);
    frame.pack();
    frame.setVisible(true);
}

From source file:MainClass.java

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

    JTextField nameTextField = new JTextField();
    frame.add(nameTextField, BorderLayout.NORTH);

    FileReader reader = null;/*from   www  .  java 2 s. c om*/
    try {
        reader = new FileReader("fileName.txt");
        nameTextField.read(reader, "fileName.txt");
    } catch (IOException exception) {
        System.err.println("Load oops");
        exception.printStackTrace();
    } finally {
        if (reader != null) {
            try {
                reader.close();
            } catch (IOException exception) {
                System.err.println("Error closing reader");
                exception.printStackTrace();
            }
        }
    }

    frame.setSize(250, 100);
    frame.setVisible(true);
}