Modifier and Type | Field and Description |
---|---|
protected boolean |
state |
displayString, exit
Modifier | Constructor and Description |
---|---|
protected |
CheckedMenuItem()
Constructor for derived classes.
|
|
CheckedMenuItem(java.lang.String displayString,
boolean initiallyChecked)
Constructor for using this class for a generic menu entry.
|
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getDisplayString()
Return the string to display as the menu choice.
|
boolean |
isChecked()
Return
true if this item's state is checked, false otherwise. |
void |
run()
Called when
MenuItem is selected by the user. |
exitAfterRun
protected CheckedMenuItem()
Derived classes must override exitAfterRun() if they want
it to return true
;
public CheckedMenuItem(java.lang.String displayString, boolean initiallyChecked)
true
from
exitAfterRun()
.displayString
- menu item textpublic boolean isChecked()
true
if this item's state is checked, false
otherwise.true
or false
public void run()
MenuItem
is selected by the user.
Default implementation toggles state
public java.lang.String getDisplayString()
getDisplayString
in class MenuItem