Class Prompt.Select<T>

java.lang.Object
com.codename1.cli.Prompt.Select<T>
Enclosing class:
Prompt

public static final class Prompt.Select<T> extends Object
A single-choice list with options: labels, a default, page size, filtering.
  • Constructor Details

    • Select

      public Select(String question, List<T> choices)
      A selection among choices.
  • Method Details

    • labeler

      public Prompt.Select<T> labeler(Prompt.Labeler<T> labeler)
      How a choice is shown; String.valueOf by default.
    • defaultIndex

      public Prompt.Select<T> defaultIndex(int index)
      The choice the cursor starts on.
    • pageSize

      public Prompt.Select<T> pageSize(int size)
      How many choices are shown at once; 10 by default.
    • filter

      public Prompt.Select<T> filter(boolean on)
      Whether typing filters the list; on by default.
    • ask

      public T ask()

      Asks and answers the choice made.

      Throws
      • IllegalArgumentException: when there are no choices.