Localize strings
[fanfix.git] / src / jexer / TButton.java
index fc93c782b5fda5c66ff01a9297fc23ee53588837..3b60cad037bba20c10d2f4d6520738a774ca2159 100644 (file)
@@ -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();
         }