Example usage for javax.swing JList getAnchorSelectionIndex

List of usage examples for javax.swing JList getAnchorSelectionIndex

Introduction

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

Prototype

@BeanProperty(bound = false)
public int getAnchorSelectionIndex() 

Source Link

Document

Returns the anchor selection index.

Usage

From source file:Main.java

public static void main(final String args[]) {
    String labels[] = { "A", "B", "C", "D", "E" };
    JFrame frame = new JFrame("Sizing Samples");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    JList jlist1 = new JList();
    jlist1.setListData(labels);/*from ww w  . ja  va  2s  . com*/

    jlist1.setVisibleRowCount(4);
    JScrollPane scrollPane1 = new JScrollPane(jlist1);
    frame.add(scrollPane1, BorderLayout.NORTH);

    int i = jlist1.getAnchorSelectionIndex();

    frame.setSize(300, 350);
    frame.setVisible(true);
}