Package swingtree.api

Interface ListEntryDelegate<E,L extends JList<E>>

Type Parameters:
E - The type of the entries in the JList.
L - The type of the JList being rendered.

public interface ListEntryDelegate<E,L extends JList<E>>
A context object providing JList entry specific context information for the functional ListEntryRenderer interface, which is used to render list entries.
  • Method Summary

    Modifier and Type
    Method
    Description
    Exposes the item inside the rendered list entry in the form of an Optional.
    boolean
    A convenience method to check if the entry has focus, which is usually noticeable by a distinct background color.
    int
    Exposes the position of the rendered list entry in the form of an integer based index number.
    boolean
    A convenience method to check if the entry is selected, which is usually noticeable by a distinct background color.
    Exposes the JList that is being rendered.
  • Method Details

    • list

      L list()
      Exposes the JList that is being rendered.
      Returns:
      The list being rendered.
    • entry

      Optional<E> entry()
      Exposes the item inside the rendered list entry in the form of an Optional. The Optional will be empty if the entry is not present (null or out of bounds).
      Returns:
      An Optional containing the value of the entry being rendered, or an empty Optional if the entry is not present (null or out of bounds).
    • index

      int index()
      Exposes the position of the rendered list entry in the form of an integer based index number.
      Returns:
      The index of the entry being rendered or -1 if out of bounds.
    • isSelected

      boolean isSelected()
      A convenience method to check if the entry is selected, which is usually noticeable by a distinct background color.
      Returns:
      true if the entry is selected, false otherwise.
    • hasFocus

      boolean hasFocus()
      A convenience method to check if the entry has focus, which is usually noticeable by a distinct background color.
      Returns:
      true if the entry is focused, false otherwise.