Example usage for javax.swing DefaultListSelectionModel getLeadSelectionIndex

List of usage examples for javax.swing DefaultListSelectionModel getLeadSelectionIndex

Introduction

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

Prototype

@Transient
public int getLeadSelectionIndex() 

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);//from   w ww .  ja v  a  2 s .  c  om

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

    add(pane, BorderLayout.NORTH);
}