misc fixes
[fanfix.git] / src / jexer / TButton.java
index 29f37432826cf7fbc3556df35462117cc557ced8..9c0e98be0a799765a013f278f1575f5562389a35 100644 (file)
@@ -68,6 +68,11 @@ public class TButton extends TWidget {
      */
     private TAction action;
 
+    /**
+     * The background color used for the button "shadow".
+     */
+    private CellAttributes shadowColor;
+
     // ------------------------------------------------------------------------
     // Constructors -----------------------------------------------------------
     // ------------------------------------------------------------------------
@@ -92,6 +97,11 @@ public class TButton extends TWidget {
         setY(y);
         setHeight(2);
         setWidth(mnemonic.getRawLabel().length() + 3);
+
+        shadowColor = new CellAttributes();
+        shadowColor.setTo(getWindow().getBackground());
+        shadowColor.setForeColor(Color.BLACK);
+        shadowColor.setBold(false);
     }
 
     /**
@@ -209,10 +219,6 @@ public class TButton extends TWidget {
     public void draw() {
         CellAttributes buttonColor;
         CellAttributes menuMnemonicColor;
-        CellAttributes shadowColor = new CellAttributes();
-        shadowColor.setTo(getWindow().getBackground());
-        shadowColor.setForeColor(Color.BLACK);
-        shadowColor.setBold(false);
 
         if (!isEnabled()) {
             buttonColor = getTheme().getColor("tbutton.disabled");
@@ -275,4 +281,16 @@ public class TButton extends TWidget {
         }
     }
 
+    /**
+     * Set the background color used for the button "shadow".
+     *
+     * @param color the new background color
+     */
+    public void setShadowColor(final CellAttributes color) {
+        shadowColor = new CellAttributes();
+        shadowColor.setTo(color);
+        shadowColor.setForeColor(Color.BLACK);
+        shadowColor.setBold(false);
+    }
+
 }