Example usage for javax.swing JList JList

List of usage examples for javax.swing JList JList

Introduction

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

Prototype

public JList(final Vector<? extends E> listData) 

Source Link

Document

Constructs a JList that displays the elements in the specified Vector.

Usage

From source file:Main.java

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

    String prefix = "b";

    int start = 0;

    int itemIx = list.getNextMatch(prefix, start, javax.swing.text.Position.Bias.Forward);
    System.out.println(itemIx);/* w w w . j a  va 2s  . co  m*/
}

From source file:Main.java

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

From source file:Main.java

public static void main(String[] argv) throws Exception {
    String[] items = { "A", "B", "C", "D" };
    JList list = new JList(items);
    list.clearSelection();/*from w ww.ja v  a 2  s .  c o m*/
}

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 lastSelIx = list.getMinSelectionIndex();
}

From source file:Main.java

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

    boolean b = list.getDragEnabled();
}

From source file:Main.java

public static void main(String[] argv) throws Exception {
    String[] items = { "A", "B", "C", "D" };
    JList list = new JList(items);
    // Get number of visible items
    int visibleSize = list.getVisibleRowCount();
}

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 lastSelIx = list.getMaxSelectionIndex();
}

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 itemIx = list.getLastVisibleIndex();
}

From source file:Main.java

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

    boolean anySelected = !list.isSelectionEmpty();

}

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 index = 2;
    boolean isSel = list.isSelectedIndex(index);
}