Java Swing Tutorial - Java JList .removeSelectionInterval (int index0, int index1)








Syntax

JList.removeSelectionInterval(int index0, int index1) has the following syntax.

public void removeSelectionInterval(int index0,    int index1)

Example

In the following code shows how to use JList.removeSelectionInterval(int index0, int index1) method.

//w w  w. j a v  a 2s.  c o  m
import javax.swing.JList;

public class Main {
  public static void main(String[] argv) throws Exception {
    String[] items = { "A", "B", "C", "D" };
    JList list = new JList(items);

    int start = 0;
    int end = 0;
    list.removeSelectionInterval(start, end);
  }
}