Example usage for javax.swing DefaultListSelectionModel removeIndexInterval

List of usage examples for javax.swing DefaultListSelectionModel removeIndexInterval

Introduction

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

Prototype

public void removeIndexInterval(int index0, int index1) 

Source Link

Document

Remove the indices in the interval index0,index1 (inclusive) from the selection model.

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 www.  j  av  a2  s.  c  o  m
    });

    list.setSelectionModel(m);

    m.removeIndexInterval(1, 1);

    add(pane, BorderLayout.NORTH);
}