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 Main() {
    setPreferredSize(new Dimension(300, 300));
    getContentPane().setLayout(new BorderLayout());

    flowPanel.add(new JLabel("One"));
    flowPanel.add(new JLabel("Two"));
    flowPanel.add(new JLabel("Three"));
    flowPanel.add(new JLabel("Four"));
    flowPanel.add(new JLabel("Five"));

    getContentPane().add(flowPanel, BorderLayout.NORTH);
    addComponentListener(new ComponentAdapter() {
        public void componentResized(ComponentEvent e) {
            Main.this.getContentPane().remove(flowPanel);
            Main.this.getContentPane().add(flowPanel);
        }//from   w  w  w  .  j a  v  a  2s.  c  o  m
    });
}

From source file:Main.java

public Main() {
    setLayout(new BorderLayout());

    list = new JList(label);
    JScrollPane pane = new JScrollPane(list);

    DefaultListSelectionModel m = new DefaultListSelectionModel();
    m.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    m.setLeadAnchorNotificationEnabled(false);
    list.setSelectionModel(m);//w w w .j  a v  a 2  s  .co m

    m.clearSelection();

    add(pane, BorderLayout.NORTH);
}

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();
            }//  www.  j av a  2  s . c o m
            bar.setValue(value);
        }
    });

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

From source file:Main.java

public Main() {
    setLayout(new BorderLayout());

    list = new JList(label);
    JScrollPane pane = new JScrollPane(list);

    DefaultListSelectionModel m = new DefaultListSelectionModel();
    m.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    m.setLeadAnchorNotificationEnabled(false);
    list.setSelectionModel(m);//from   www  .j  a  v a 2 s  .  c  o  m

    m.addSelectionInterval(1, 1);

    add(pane, BorderLayout.NORTH);
}

From source file:Main.java

public Main() {

    JButton btn1 = new JButton("Button1");
    JButton btn2 = new JButton("Button2");
    JButton btn3 = new JButton("Button3");
    JButton btn4 = new JButton("Button4");
    JButton btn5 = new JButton("Button5");
    JButton btn6 = new JButton("Button6");

    BorderLayout borderLayout = new BorderLayout(20, 30);

    setLayout(borderLayout);//w ww  .  j a  va2  s  .c o  m

    add("North", btn1);
    add("West", btn2);
    add("Center", btn3);
    add("South", btn5);
    add("East", btn6);

    System.out.println(borderLayout.getLayoutComponent(this, BorderLayout.NORTH));
}

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();
            }//w  w  w  .ja  v a 2 s  .  co  m
            bar.setValue(value);
        }
    });

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

From source file:Main.java

Main() {
    Updater updater = new Updater();
    width.addChangeListener(updater);//www .j a  va2 s . c  om
    height.addChangeListener(updater);
    JFrame f = new JFrame();
    f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    f.add(width, BorderLayout.NORTH);
    f.add(height, BorderLayout.WEST);
    f.add(dynamicLabel, BorderLayout.CENTER);
    f.setSize(210, 210);
    f.setVisible(true);

}

From source file:Main.java

public Main() {

    JButton btn1 = new JButton("Button1");
    JButton btn2 = new JButton("Button2");
    JButton btn3 = new JButton("Button3");
    JButton btn4 = new JButton("Button4");
    JButton btn5 = new JButton("Button5");
    JButton btn6 = new JButton("Button6");

    BorderLayout borderLayout = new BorderLayout(20, 30);

    setLayout(borderLayout);//from  w ww  .j  av a 2  s.c  om

    add("North", btn1);
    add("West", btn2);
    add("Center", btn3);
    add("Center", btn4);
    add("South", btn5);
    add("East", btn6);

    System.out.println(borderLayout.getLayoutComponent(BorderLayout.NORTH));
}

From source file:JapaneseCalendar.java

public JapaneseCalendar() {
    setLayout(new BorderLayout());
    final CalendarPane cp = new CalendarPane(Locale.JAPANESE);
    add(cp, BorderLayout.NORTH);
}

From source file:Main.java

public Main() {
    Date date = new Date();
    SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
    String dateString = formatter.format(date);
    formatText = new JFormattedTextField(createFormatter("####-##-## ##:##:##"));
    formatText.setColumns(20);//from   ww  w  .  j  a  v  a 2s . c  o  m
    formatText.setText(dateString);

    setLayout(new BorderLayout());
    add(new JLabel("Enter Date and Time in YYYY-MM-DD HH:MM:SS format"), BorderLayout.NORTH);
    add(formatText, BorderLayout.CENTER);
}