Class ArduinoScrollButton<T>

java.lang.Object
net.sourceforge.jarduino.gui.ArduinoScrollButton<T>
Type Parameters:
T - the type of object

public class ArduinoScrollButton<T>
extends Object
Button with scrollable popupMenu.
  • Method Details

    • getComponent

      public JComponent getComponent()
      Obtain the component.
      Returns:
      the component
    • setMaxDisplayItems

      public void setMaxDisplayItems​(int pMaxItems)
      Set the maxItems to display.
      Parameters:
      pMaxItems - the maximum items
    • getMaxDisplayItems

      public int getMaxDisplayItems()
      Obtain the maxItems to display.
      Returns:
      the maxItems
    • getHighlightColor

      public Color getHighlightColor()
      Obtain the highlight colour.
      Returns:
      the colour
    • setHighlightColor

      public void setHighlightColor​(Color pColor)
      Set the item highlight color.
      Parameters:
      pColor - the color
    • add

      public void add​(T pItem)
      Add item to menu.
      Parameters:
      pItem - the item to add
    • removeAll

      public void removeAll()
      Remove all items.
    • setFormatter

      public void setFormatter​(Function<T,​String> pFormatter)
      Set the formatter.
      Parameters:
      pFormatter - the formatter
    • onSelect

      public void onSelect​(Consumer<T> pConsumer)
      Set the action consumer.
      Parameters:
      pConsumer - the consumer
    • setSelectedItem

      public void setSelectedItem​(T pItem)
      Set the selected item.
      Parameters:
      pItem - the item
    • getSelectedItem

      public T getSelectedItem()
      Obtain the selected item.
      Returns:
      the item