Skip to content

Commit 286ce15

Browse files
committed
ToggleButton: styling selectedForeground did not work if foreground is also styled (issue #1017)
1 parent abfaf86 commit 286ce15

2 files changed

Lines changed: 8 additions & 0 deletions

File tree

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ FlatLaf Change Log
44
## 3.6.1-SNAPSHOT
55

66
- Extras: Support JSVG 2.0.0. Minimum JSVG version is now 1.6.0. (issue #997)
7+
- ToggleButton: Styling `selectedForeground` did not work if `foreground` is
8+
also styled. (issue #1017)
79
- JideSplitButton: Fixed updating popup when switching theme. (issue #1000)
810
- IntelliJ Themes: Fixed logging false errors when loading 3rd party
911
`.theme.json` files. (issue #990)

flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatButtonUI.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -381,6 +381,12 @@ protected Object applyStyleProperty( AbstractButton b, String key, Object value
381381
return ((FlatHelpButtonIcon)helpButtonIcon).applyStyleProperty( key, value );
382382
}
383383

384+
// update internal values; otherwise isCustomBackground() and isCustomForeground() would return wrong results
385+
switch( key ) {
386+
case "background": background = (Color) value; break;
387+
case "foreground": foreground = (Color) value; break;
388+
}
389+
384390
if( "iconTextGap".equals( key ) && value instanceof Integer )
385391
value = UIScale.scale( (Integer) value );
386392

0 commit comments

Comments
 (0)