*/
private TAction action;
- /**
- * The time at which dispatch() was called.
- */
- private long dispatchTime;
-
- /**
- * How long to animate dispatch of the event in millis.
- */
- private static final long DISPATCH_TIME = 75;
-
/**
* 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) {
- long now = System.currentTimeMillis();
- if (now - dispatchTime > DISPATCH_TIME) {
- action.DO();
- dispatchTime = now;
- }
+ action.DO();
+ inButtonPress = false;
}
}
shadowColor.setForeColor(Color.BLACK);
shadowColor.setBold(false);
- long now = System.currentTimeMillis();
- boolean inDispatch = false;
- if (now - dispatchTime < DISPATCH_TIME) {
- inDispatch = true;
- }
-
if (!isEnabled()) {
buttonColor = getTheme().getColor("tbutton.disabled");
menuMnemonicColor = getTheme().getColor("tbutton.disabled");
menuMnemonicColor = getTheme().getColor("tbutton.mnemonic");
}
- if (inButtonPress || inDispatch) {
+ if (inButtonPress) {
getScreen().putCharXY(1, 0, ' ', buttonColor);
getScreen().putStringXY(2, 0, mnemonic.getRawLabel(), buttonColor);
getScreen().putCharXY(getWidth() - 1, 0, ' ', buttonColor);
GraphicsChars.CP437[0xDF], shadowColor);
}
if (mnemonic.getShortcutIdx() >= 0) {
- if (inButtonPress || inDispatch) {
+ if (inButtonPress) {
getScreen().putCharXY(2 + mnemonic.getShortcutIdx(), 0,
mnemonic.getShortcut(), menuMnemonicColor);
} else {
this.mouse = mouse;
if (inButtonPress && mouse.isMouse1()) {
- inButtonPress = false;
// Dispatch the event
dispatch();
}