-/**
+/*
* Jexer - Java Text User Interface
*
* License: LGPLv3 or later
*
* @return mnemonic string
*/
- public final MnemonicString getMnemonic() {
+ public MnemonicString getMnemonic() {
return mnemonic;
}
*/
private TAction action;
+ /**
+ * Act as though the button was pressed. This is useful for other UI
+ * elements to get the same action as if the user clicked the button.
+ */
+ public void dispatch() {
+ if (action != null) {
+ action.DO();
+ }
+ }
+
/**
* Private constructor.
*
if (inButtonPress) {
getScreen().putCharXY(1, 0, ' ', buttonColor);
- getScreen().putStrXY(2, 0, mnemonic.getRawLabel(), buttonColor);
+ getScreen().putStringXY(2, 0, mnemonic.getRawLabel(), buttonColor);
getScreen().putCharXY(getWidth() - 1, 0, ' ', buttonColor);
} else {
getScreen().putCharXY(0, 0, ' ', buttonColor);
- getScreen().putStrXY(1, 0, mnemonic.getRawLabel(), buttonColor);
+ getScreen().putStringXY(1, 0, mnemonic.getRawLabel(), buttonColor);
getScreen().putCharXY(getWidth() - 2, 0, ' ', buttonColor);
getScreen().putCharXY(getWidth() - 1, 0,