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 void
add(T pItem)
Add item to menu.JComponent
getComponent()
Obtain the component.Color
getHighlightColor()
Obtain the highlight colour.int
getMaxDisplayItems()
Obtain the maxItems to display.T
getSelectedItem()
Obtain the selected item.void
onSelect(Consumer<T> pConsumer)
Set the action consumer.void
removeAll()
Remove all items.void
setFormatter(Function<T,String> pFormatter)
Set the formatter.void
setHighlightColor(Color pColor)
Set the item highlight color.void
setMaxDisplayItems(int pMaxItems)
Set the maxItems to display.void
setSelectedItem(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
-