X-Git-Url: http://git.nikiroo.be/?a=blobdiff_plain;f=src%2Fjexer%2FTButton.java;h=83ff2d241f0c1c31dc27b45c65285c346f87b417;hb=d610cbd252f5595f2558960b97424d67c7ffe84c;hp=29f37432826cf7fbc3556df35462117cc557ced8;hpb=a69ed767c9c07cf35cf1c5f7821fc009cfe79cd2;p=fanfix.git diff --git a/src/jexer/TButton.java b/src/jexer/TButton.java index 29f3743..83ff2d2 100644 --- a/src/jexer/TButton.java +++ b/src/jexer/TButton.java @@ -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"); @@ -247,7 +253,6 @@ public class TButton extends TWidget { putCharXY(1 + mnemonic.getShortcutIdx(), 0, mnemonic.getShortcut(), menuMnemonicColor); } - } } @@ -275,4 +280,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); + } + }