Example usage for javax.swing JList addSelectionInterval

List of usage examples for javax.swing JList addSelectionInterval

Introduction

In this page you can find the example usage for javax.swing JList addSelectionInterval.

Prototype

public void addSelectionInterval(int anchor, int lead) 

Source Link

Document

Sets the selection to be the union of the specified interval with current selection.

Usage

From source file:Main.java

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

    int start = 2;
    int end = 2;// ww w  . j  a v  a 2 s.co m
    list.addSelectionInterval(start, end);
}