Example usage for javax.swing DefaultListSelectionModel getListSelectionListeners

List of usage examples for javax.swing DefaultListSelectionModel getListSelectionListeners

Introduction

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

Prototype

public ListSelectionListener[] getListSelectionListeners() 

Source Link

Document

Returns an array of all the list selection listeners registered on this DefaultListSelectionModel.

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());
        }//from   w ww.  j a v  a  2s  . c  o  m
    });

    list.setSelectionModel(m);

    ListSelectionListener[] lis = m.getListSelectionListeners();

    add(pane, BorderLayout.NORTH);
}