Example usage for javax.swing DefaultListSelectionModel clearSelection

List of usage examples for javax.swing DefaultListSelectionModel clearSelection

Introduction

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

Prototype

public void clearSelection() 

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);/*  w  w  w.java  2  s  .  co  m*/

    m.clearSelection();

    add(pane, BorderLayout.NORTH);
}