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() {
    setLayout(new BorderLayout());

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

    DefaultListSelectionModel m = new DefaultListSelectionModel();

    m.addListSelectionListener(new ListSelectionListener() {
        public void valueChanged(ListSelectionEvent e) {
            System.out.println(e.toString());
        }//ww  w  . jav  a 2  s  . c om
    });

    list.setSelectionModel(m);

    m.removeSelectionInterval(1, 1);

    add(pane, BorderLayout.NORTH);
}

From source file:Main.java

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

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

    DefaultListSelectionModel m = new DefaultListSelectionModel();

    m.addListSelectionListener(new ListSelectionListener() {
        public void valueChanged(ListSelectionEvent e) {
            System.out.println(e.toString());
        }//from w w  w. ja  v a2 s.  c om
    });

    list.setSelectionModel(m);

    System.out.println(m.toString());

    add(pane, BorderLayout.NORTH);
}

From source file:Main.java

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

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

    DefaultListSelectionModel m = new DefaultListSelectionModel();

    m.addListSelectionListener(new ListSelectionListener() {
        public void valueChanged(ListSelectionEvent e) {
            System.out.println(e.toString());
        }/*from w w  w. ja va  2  s.  co m*/
    });

    list.setSelectionModel(m);

    m.insertIndexInterval(1, 2, true);

    add(pane, BorderLayout.NORTH);
}

From source file:Main.java

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

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

    DefaultListSelectionModel m = new DefaultListSelectionModel();

    m.addListSelectionListener(new ListSelectionListener() {
        public void valueChanged(ListSelectionEvent e) {
            System.out.println(e.toString());
        }/*from  www .  j  a v  a  2 s .co m*/
    });

    list.setSelectionModel(m);

    System.out.println(m.isSelectedIndex(0));

    add(pane, BorderLayout.NORTH);
}

From source file:Main.java

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

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

    DefaultListSelectionModel m = new DefaultListSelectionModel();

    m.addListSelectionListener(new ListSelectionListener() {
        public void valueChanged(ListSelectionEvent e) {
            System.out.println(e.toString());
        }/* w  w w . j av a 2  s . c o  m*/
    });

    list.setSelectionModel(m);

    System.out.println(m.isSelectionEmpty());

    add(pane, BorderLayout.NORTH);
}

From source file:Main.java

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

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

    DefaultListSelectionModel m = new DefaultListSelectionModel();

    m.addListSelectionListener(new ListSelectionListener() {
        public void valueChanged(ListSelectionEvent e) {
            System.out.println(e.toString());
        }//ww w  . ja  v a 2 s.  c om
    });

    list.setSelectionModel(m);

    System.out.println(m.getMaxSelectionIndex());

    add(pane, BorderLayout.NORTH);
}

From source file:Main.java

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

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

    DefaultListSelectionModel m = new DefaultListSelectionModel();

    m.addListSelectionListener(new ListSelectionListener() {
        public void valueChanged(ListSelectionEvent e) {
            System.out.println(e.toString());
        }//w ww  .  j  a  v a2s.co  m
    });

    list.setSelectionModel(m);

    System.out.println(m.getMinSelectionIndex());

    add(pane, BorderLayout.NORTH);
}

From source file:Main.java

public Main() {
    setSize(400, 300);/*w w w .  j  a v  a  2  s. co  m*/
    cardPanel.setLayout(cardLayout);
    jp1.add(jl1);
    jp2.add(jl2);
    cardPanel.add(jp1, "1");
    cardPanel.add(jp2, "2");

    btn1.addActionListener(e -> cardLayout.show(cardPanel, "1"));
    btn2.addActionListener(e -> cardLayout.show(cardPanel, "2"));
    buttonPanel.add(btn1);
    buttonPanel.add(btn2);
    add(cardPanel, BorderLayout.NORTH);
    add(buttonPanel, BorderLayout.SOUTH);
}

From source file:Main.java

public TextStyleTestFrame() {
    textPane.setText("this is a test.");
    add(textPane, BorderLayout.CENTER);
    add(btnStyle, BorderLayout.NORTH);
    btnStyle.addActionListener(e -> changeStyle());
}

From source file:Main.java

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

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

    DefaultListSelectionModel m = new DefaultListSelectionModel();

    m.addListSelectionListener(new ListSelectionListener() {
        public void valueChanged(ListSelectionEvent e) {
            System.out.println(e.toString());
        }//from   w w  w .ja  v  a2s  . c  o  m
    });

    list.setSelectionModel(m);

    System.out.println(m.isLeadAnchorNotificationEnabled());

    add(pane, BorderLayout.NORTH);
}