JIDE: JideButton, JideToggleButton, JideSplitButton and JideToggleSplitButton: paint border in button style TOOLBAR_STYLE if in selected state (issue #1045)
Some checks failed
CI / build (11) (push) Has been cancelled
CI / build-on (17, ) (push) Has been cancelled
CI / build-on (21, ) (push) Has been cancelled
CI / build-on (21, 25) (push) Has been cancelled
CI / build-on (8, ) (push) Has been cancelled
CI / snapshot (push) Has been cancelled
CI / release (push) Has been cancelled

This commit is contained in:
Karl Tauber
2025-10-24 19:50:04 +02:00
parent 960f9d86c1
commit 0d4946230e
2 changed files with 21 additions and 7 deletions

View File

@@ -7,7 +7,8 @@ FlatLaf Change Log
`null`. (issue #1047)
- Extras: UI defaults inspector: Exclude inspector window from being blocked by
modal dialogs. (issue #1048)
- JideButton, JideToggleButton, JideSplitButton and JideToggleSplitButton: Paint
border in button style `TOOLBAR_STYLE` if in selected state. (issue #1045)
## 3.6.2

View File

@@ -65,6 +65,7 @@ public class FlatJidePainter
Color oldColor = g.getColor();
g.setColor( FlatUIUtils.deriveColor( background, c.getBackground() ) );
Object[] oldRenderingHints = FlatUIUtils.setRenderingHints( g );
float arc = UIScale.scale( (float) this.arc );
if( c instanceof JideSplitButton ) {
// For split buttons, this method is invoked twice:
@@ -74,6 +75,8 @@ public class FlatJidePainter
// the rounded rectangle with component bounds, but clip to the passed rectangle.
boolean horizontal = (((JideSplitButton)c).getOrientation() == SwingConstants.HORIZONTAL);
int width = horizontal ? c.getWidth() : c.getHeight();
int height = horizontal ? c.getHeight() : c.getWidth();
// for vertical orientation, the graphics context is rotated, but 1px wrong
if( !horizontal )
@@ -82,10 +85,13 @@ public class FlatJidePainter
Shape oldClip = g.getClip();
g.clipRect( rect.x, rect.y, rect.width, rect.height );
FlatUIUtils.paintComponentBackground( (Graphics2D) g, 0, 0,
horizontal ? c.getWidth() : c.getHeight(),
horizontal ? c.getHeight() : c.getWidth(),
0, UIScale.scale( (float) arc ) );
FlatUIUtils.paintComponentBackground( (Graphics2D) g, 0, 0, width, height, 0, arc );
if( borderColor != null ) {
g.setColor( borderColor );
FlatUIUtils.paintOutlinedComponent( (Graphics2D) g, 0, 0, width, height,
0, 0, 0, UIScale.scale( 1f ), arc, null, borderColor, null );
}
g.setClip( oldClip );
@@ -98,8 +104,15 @@ public class FlatJidePainter
if( !horizontal )
g.translate( 0, 1 );
} else {
FlatUIUtils.paintComponentBackground( (Graphics2D) g, rect.x, rect.y,
rect.width, rect.height, 0, UIScale.scale( (float) arc ) );
FlatUIUtils.paintComponentBackground( (Graphics2D) g,
rect.x, rect.y, rect.width, rect.height, 0, arc );
if( borderColor != null ) {
g.setColor( borderColor );
FlatUIUtils.paintOutlinedComponent( (Graphics2D) g,
rect.x, rect.y, rect.width, rect.height,
0, 0, 0, UIScale.scale( 1f ), arc, null, borderColor, null );
}
}
FlatUIUtils.resetRenderingHints( g, oldRenderingHints );