public final class MenuItem extends Object implements SelectableOption
| Constructor and Description |
|---|
MenuItem(String symbol,
Lines label)
Create new object.
|
MenuItem(String symbol,
Lines label,
Command command)
Create new object.
|
MenuItem(String symbol,
String label)
Create new object.
|
MenuItem(String symbol,
String label,
Command command)
Create new object.
|
| Modifier and Type | Method and Description |
|---|---|
Command |
getCommand()
Get the command to execute.
|
Lines |
getLabel()
Get the label.
|
String |
getSymbol()
Get the symbol to select this option.
|
boolean |
isSelected(String symbol)
Check if this option is selected.
|
void |
print(PrintWriter writer,
int length,
boolean isDefault)
Print the option.
|
public MenuItem(String symbol, String label)
symbol - the symbol to select this menu item.label - the label.public MenuItem(String symbol, Lines label)
symbol - the symbol to select this menu item.label - the label.public MenuItem(String symbol, String label, Command command)
symbol - the symbol to select this menu item.label - the label.command - the command to execute if this menu item is selected.public String getSymbol()
SelectableOptiongetSymbol in interface SelectableOptionpublic Lines getLabel()
SelectableOptiongetLabel in interface SelectableOptionpublic void print(PrintWriter writer, int length, boolean isDefault)
Optionpublic boolean isSelected(String symbol)
SelectableOptionisSelected in interface SelectableOptionsymbol - the user input.public Command getCommand()
SelectableOptiongetCommand in interface SelectableOptionCopyright © 2019. All rights reserved.