Example usage for javax.swing DefaultListSelectionModel getAnchorSelectionIndex

List of usage examples for javax.swing DefaultListSelectionModel getAnchorSelectionIndex

Introduction

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

Prototype

@Transient
public int getAnchorSelectionIndex() 

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();

    list.setSelectionModel(m);// w  w w  . j av  a 2  s.c  om

    System.out.println(m.getAnchorSelectionIndex());

    add(pane, BorderLayout.NORTH);
}