Example usage for javax.swing JList getNextMatch

List of usage examples for javax.swing JList getNextMatch

Introduction

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

Prototype

public int getNextMatch(String prefix, int startIndex, Position.Bias bias) 

Source Link

Document

Returns the next list element whose toString value starts with the given prefix.

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

    String prefix = "b";

    int start = 0;

    int itemIx = list.getNextMatch(prefix, start, javax.swing.text.Position.Bias.Forward);
}

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 ww  . ja va 2  s .c  o m*/
}