Example usage for javax.swing DefaultListSelectionModel getMaxSelectionIndex

List of usage examples for javax.swing DefaultListSelectionModel getMaxSelectionIndex

Introduction

In this page you can find the example usage for javax.swing DefaultListSelectionModel getMaxSelectionIndex.

Prototype

public int getMaxSelectionIndex() 

Source Link

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());
        }//www .  j a v a2 s  .  c om
    });

    list.setSelectionModel(m);

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

    add(pane, BorderLayout.NORTH);
}