Class Dropdown.Builder<T>
- Type Parameters:
T- the value type
Builds a
Dropdown; from Dropdown.builder(String). The same setters as Cycle.Builder, plus the
options every entry has (Entry.Builder).-
Method Summary
Modifier and TypeMethodDescriptionbuild()Builds the dropdown.A fixed label; seelabel(Supplier).The text before ": value" and the picker's title, re-read on every refresh.Stores the picked value; runs on the main thread after the picker has closed.Reads the mod's current value; re-read on every refresh.The values the picker lists, in order.How a value is shown on the button and in the picker's rows.
-
Method Details
-
label
The text before ": value" and the picker's title, re-read on every refresh. Required.- Parameters:
label- read on refresh- Returns:
- this builder
-
label
A fixed label; seelabel(Supplier).- Parameters:
label- the label- Returns:
- this builder
-
values
The values the picker lists, in order. Required, not empty. Copied at build time: to offer a list that changes, build the screen again (e.g. reopen it).- Parameters:
values- the values; must implementObject.equals(Object)consistently- Returns:
- this builder
-
value
Reads the mod's current value; re-read on every refresh. Required. A value not invaluesshows as the first one.- Parameters:
value- reads the current value- Returns:
- this builder
-
valueText
How a value is shown on the button and in the picker's rows. Required.- Parameters:
valueText- maps a value to its text; never returnsnull- Returns:
- this builder
-
onChange
Stores the picked value; runs on the main thread after the picker has closed. Required.- Parameters:
onChange- receives the picked value- Returns:
- this builder
-
build
Builds the dropdown.- Returns:
- the dropdown
- Throws:
IllegalStateException- if a required field is missing orvaluesis empty
-