X-Git-Url: http://git.nikiroo.be/?a=blobdiff_plain;f=src%2Fjexer%2FTButton.java;fp=src%2Fjexer%2FTButton.java;h=9c0e98be0a799765a013f278f1575f5562389a35;hb=e23ea53820244957b17a7000c6d3e1ff586f1ef0;hp=29f37432826cf7fbc3556df35462117cc557ced8;hpb=4c46ea176c25101865057accbfe01da1d9b6b8ab;p=fanfix.git diff --git a/src/jexer/TButton.java b/src/jexer/TButton.java index 29f3743..9c0e98b 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"); @@ -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); + } + }