mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2025-12-06 05:50:53 +03:00
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
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:
@@ -7,7 +7,8 @@ FlatLaf Change Log
|
|||||||
`null`. (issue #1047)
|
`null`. (issue #1047)
|
||||||
- Extras: UI defaults inspector: Exclude inspector window from being blocked by
|
- Extras: UI defaults inspector: Exclude inspector window from being blocked by
|
||||||
modal dialogs. (issue #1048)
|
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
|
## 3.6.2
|
||||||
|
|
||||||
|
|||||||
@@ -65,6 +65,7 @@ public class FlatJidePainter
|
|||||||
Color oldColor = g.getColor();
|
Color oldColor = g.getColor();
|
||||||
g.setColor( FlatUIUtils.deriveColor( background, c.getBackground() ) );
|
g.setColor( FlatUIUtils.deriveColor( background, c.getBackground() ) );
|
||||||
Object[] oldRenderingHints = FlatUIUtils.setRenderingHints( g );
|
Object[] oldRenderingHints = FlatUIUtils.setRenderingHints( g );
|
||||||
|
float arc = UIScale.scale( (float) this.arc );
|
||||||
|
|
||||||
if( c instanceof JideSplitButton ) {
|
if( c instanceof JideSplitButton ) {
|
||||||
// For split buttons, this method is invoked twice:
|
// 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.
|
// the rounded rectangle with component bounds, but clip to the passed rectangle.
|
||||||
|
|
||||||
boolean horizontal = (((JideSplitButton)c).getOrientation() == SwingConstants.HORIZONTAL);
|
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
|
// for vertical orientation, the graphics context is rotated, but 1px wrong
|
||||||
if( !horizontal )
|
if( !horizontal )
|
||||||
@@ -82,10 +85,13 @@ public class FlatJidePainter
|
|||||||
Shape oldClip = g.getClip();
|
Shape oldClip = g.getClip();
|
||||||
g.clipRect( rect.x, rect.y, rect.width, rect.height );
|
g.clipRect( rect.x, rect.y, rect.width, rect.height );
|
||||||
|
|
||||||
FlatUIUtils.paintComponentBackground( (Graphics2D) g, 0, 0,
|
FlatUIUtils.paintComponentBackground( (Graphics2D) g, 0, 0, width, height, 0, arc );
|
||||||
horizontal ? c.getWidth() : c.getHeight(),
|
|
||||||
horizontal ? c.getHeight() : c.getWidth(),
|
if( borderColor != null ) {
|
||||||
0, UIScale.scale( (float) arc ) );
|
g.setColor( borderColor );
|
||||||
|
FlatUIUtils.paintOutlinedComponent( (Graphics2D) g, 0, 0, width, height,
|
||||||
|
0, 0, 0, UIScale.scale( 1f ), arc, null, borderColor, null );
|
||||||
|
}
|
||||||
|
|
||||||
g.setClip( oldClip );
|
g.setClip( oldClip );
|
||||||
|
|
||||||
@@ -98,8 +104,15 @@ public class FlatJidePainter
|
|||||||
if( !horizontal )
|
if( !horizontal )
|
||||||
g.translate( 0, 1 );
|
g.translate( 0, 1 );
|
||||||
} else {
|
} else {
|
||||||
FlatUIUtils.paintComponentBackground( (Graphics2D) g, rect.x, rect.y,
|
FlatUIUtils.paintComponentBackground( (Graphics2D) g,
|
||||||
rect.width, rect.height, 0, UIScale.scale( (float) arc ) );
|
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 );
|
FlatUIUtils.resetRenderingHints( g, oldRenderingHints );
|
||||||
|
|||||||
Reference in New Issue
Block a user