Package net.sourceforge.jarduino.gui
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 Summary
Modifier and Type Method Description voidadd(T pItem)Add item to menu.JComponentgetComponent()Obtain the component.ColorgetHighlightColor()Obtain the highlight colour.intgetMaxDisplayItems()Obtain the maxItems to display.TgetSelectedItem()Obtain the selected item.voidonSelect(Consumer<T> pConsumer)Set the action consumer.voidremoveAll()Remove all items.voidsetFormatter(Function<T,String> pFormatter)Set the formatter.voidsetHighlightColor(Color pColor)Set the item highlight color.voidsetMaxDisplayItems(int pMaxItems)Set the maxItems to display.voidsetSelectedItem(T pItem)Set the selected item.
-
Method Details
-
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
Obtain the highlight colour.- Returns:
- the colour
-
setHighlightColor
Set the item highlight color.- Parameters:
pColor- the color
-
add
Add item to menu.- Parameters:
pItem- the item to add
-
removeAll
public void removeAll()Remove all items. -
setFormatter
Set the formatter.- Parameters:
pFormatter- the formatter
-
onSelect
Set the action consumer.- Parameters:
pConsumer- the consumer
-
setSelectedItem
Set the selected item.- Parameters:
pItem- the item
-
getSelectedItem
Obtain the selected item.- Returns:
- the item
-