mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2025-12-06 14:00:55 +03:00
ToggleButton: tab style buttons now respect explicitly set background color
This commit is contained in:
@@ -30,6 +30,8 @@ FlatLaf Change Log
|
||||
- Button and ToggleButton: ToolBar buttons now respect explicitly set background
|
||||
color. If no background color is set, then the button background is not
|
||||
painted anymore. (issue #191)
|
||||
- ToggleButton: Tab style buttons (client property `JButton.buttonType` is
|
||||
`tab`) now respect explicitly set background color.
|
||||
- TabbedPane: Fixed `IndexOutOfBoundsException` when using tooltip text on close
|
||||
buttons and closing last/rightmost tab. (issue #235)
|
||||
- Extras: Added missing export of package
|
||||
|
||||
@@ -146,10 +146,17 @@ public class FlatToggleButtonUI
|
||||
int height = c.getHeight();
|
||||
int width = c.getWidth();
|
||||
boolean selected = ((AbstractButton)c).isSelected();
|
||||
Color enabledColor = selected ? clientPropertyColor( c, TAB_BUTTON_SELECTED_BACKGROUND, tabSelectedBackground ) : null;
|
||||
|
||||
// use component background if explicitly set
|
||||
if( enabledColor == null ) {
|
||||
Color bg = c.getBackground();
|
||||
if( isCustomBackground( bg ) )
|
||||
enabledColor = bg;
|
||||
}
|
||||
|
||||
// paint background
|
||||
Color background = buttonStateColor( c,
|
||||
selected ? clientPropertyColor( c, TAB_BUTTON_SELECTED_BACKGROUND, tabSelectedBackground ) : null,
|
||||
Color background = buttonStateColor( c, enabledColor,
|
||||
null, tabFocusBackground, tabHoverBackground, null );
|
||||
if( background != null ) {
|
||||
g.setColor( background );
|
||||
|
||||
Reference in New Issue
Block a user