Expose width/height in TApplication constructor, attempt on ECMA48
[fanfix.git] / src / jexer / TButton.java
index 748fe247c035b5dccf22acc913271fb0dbc30b10..255dd990738d369490a288d993dd24dd24890c49 100644 (file)
@@ -3,7 +3,7 @@
  *
  * The MIT License (MIT)
  *
- * Copyright (C) 2016 Kevin Lamonte
+ * Copyright (C) 2017 Kevin Lamonte
  *
  * Permission is hereby granted, free of charge, to any person obtaining a
  * copy of this software and associated documentation files (the "Software"),
@@ -80,6 +80,7 @@ public final class TButton extends TWidget {
     public void dispatch() {
         if (action != null) {
             action.DO();
+            inButtonPress = false;
         }
     }
 
@@ -215,11 +216,8 @@ public final class TButton extends TWidget {
         this.mouse = mouse;
 
         if (inButtonPress && mouse.isMouse1()) {
-            inButtonPress = false;
             // Dispatch the event
-            if (action != null) {
-                action.DO();
-            }
+            dispatch();
         }
 
     }
@@ -249,9 +247,7 @@ public final class TButton extends TWidget {
             || keypress.equals(kbSpace)
         ) {
             // Dispatch
-            if (action != null) {
-                action.DO();
-            }
+            dispatch();
             return;
         }