Java Swing Tutorial - Java JList.getNextMatch(String prefix, int startIndex, Position.Bias bias)








Syntax

JList.getNextMatch(String prefix, int startIndex, Position.Bias bias) has the following syntax.

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

Example

In the following code shows how to use JList.getNextMatch(String prefix, int startIndex, Position.Bias bias) method.

import javax.swing.JList;
/*from w w  w  .j  a v a 2s. c  o  m*/
public class Main {
  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);
  }
}