Example usage for javax.swing DefaultListSelectionModel removeListSelectionListener

List of usage examples for javax.swing DefaultListSelectionModel removeListSelectionListener

Introduction

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

Prototype

public void removeListSelectionListener(ListSelectionListener l) 

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.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    m.setLeadAnchorNotificationEnabled(false);
    list.setSelectionModel(m);//from w ww.j  av  a2 s  . c  om

    ListSelectionListener lis = new ListSelectionListener() {
        public void valueChanged(ListSelectionEvent e) {
            System.out.println(e.toString());
        }
    };

    m.addListSelectionListener(lis);
    m.removeListSelectionListener(lis);

    add(pane, BorderLayout.NORTH);
}