List Option

Introduction

ListOption cycles through a list of values, providing interactive selection.

Constructor

  • ListOption(String name, Supplier<T> getter, Consumer<T> setter, List<T> values)

Behavior

  • Click: Left-click advances, right-click reverses through the list.

  • Render: Shows the option's name and current value with distinct coloring.

Example

List<String> colorOptions = Arrays.asList("Red", "Green", "Blue");
ListOption<String> colorListOption = new ListOption<>(
    "Color",
    () -> config.getSelectedColor(),
    value -> config.setSelectedColor(value),
    colorOptions
);

Last updated

Was this helpful?