X-Git-Url: http://git.nikiroo.be/?a=blobdiff_plain;f=src%2Fjexer%2FTButton.java;h=3b60cad037bba20c10d2f4d6520738a774ca2159;hb=339652cc241d738d461670c3309eaf6fc85c992a;hp=fc93c782b5fda5c66ff01a9297fc23ee53588837;hpb=1b1206070bb94d706c14400b8332a81646b77a25;p=fanfix.git diff --git a/src/jexer/TButton.java b/src/jexer/TButton.java index fc93c78..3b60cad 100644 --- a/src/jexer/TButton.java +++ b/src/jexer/TButton.java @@ -73,11 +73,6 @@ public final class TButton extends TWidget { */ private TAction action; - /** - * The time at which dispatch() was called. - */ - private long dispatchTime; - /** * How long to animate dispatch of the event in millis. */ @@ -89,11 +84,8 @@ public final class TButton extends TWidget { */ public void dispatch() { if (action != null) { - long now = System.currentTimeMillis(); - if (now - dispatchTime > DISPATCH_TIME) { - action.DO(); - dispatchTime = now; - } + action.DO(); + inButtonPress = false; } } @@ -167,12 +159,6 @@ public final class TButton extends TWidget { 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"); @@ -184,7 +170,7 @@ public final class TButton extends TWidget { 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); @@ -199,7 +185,7 @@ public final class TButton extends TWidget { GraphicsChars.CP437[0xDF], shadowColor); } if (mnemonic.getShortcutIdx() >= 0) { - if (inButtonPress || inDispatch) { + if (inButtonPress) { getScreen().putCharXY(2 + mnemonic.getShortcutIdx(), 0, mnemonic.getShortcut(), menuMnemonicColor); } else { @@ -235,7 +221,6 @@ public final class TButton extends TWidget { this.mouse = mouse; if (inButtonPress && mouse.isMouse1()) { - inButtonPress = false; // Dispatch the event dispatch(); }