Class HudFilterList<T>

Type Parameters:
T - the type of value each row stands for; null is a valid value, often meaning "all"
All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible

public class HudFilterList<T> extends JPanel
A column of filter rows for a HUD side rail: each row has a label and a count, and exactly one row is selected, raised to the surface colour with an accent bar on its left. Rows fire on mouse release and on space/enter; the up and down arrows move between rows.

Choosing a row only notifies the owner, which applies the filter and selects the row with setSelected(Object). Setting the items or the selection never notifies.

Since:
0.51.01
See Also:
  • Constructor Details

    • HudFilterList

      public HudFilterList(Consumer<T> onChoose)
      Parameters:
      onChoose - called with the row's value when the player chooses a row
  • Method Details

    • setItems

      public void setItems(List<HudFilterList.Item<T>> items)
      Replaces the rows, keeping the selection if one of the new rows has the selected value.
      Parameters:
      items - the rows, top to bottom
      Since:
      0.51.01
    • setSelected

      public void setSelected(@Nullable T value)
      Selects the row with this value, without notifying the owner.
      Parameters:
      value - the value
      Since:
      0.51.01
    • getSelected

      @Nullable public T getSelected()
      Returns:
      the selected value