mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2025-12-08 06:50:56 +03:00
Button: do not paint border and background if contentAreaFilled == false
This commit is contained in:
@@ -37,6 +37,9 @@ public class FlatButtonBorder
|
||||
{
|
||||
@Override
|
||||
public void paintBorder( Component c, Graphics g, int x, int y, int width, int height ) {
|
||||
if( !FlatButtonUI.isContentAreaFilled( c ) )
|
||||
return;
|
||||
|
||||
Graphics2D g2 = (Graphics2D) g.create();
|
||||
try {
|
||||
FlatUIUtils.setRenderingHints( g2 );
|
||||
|
||||
@@ -47,13 +47,17 @@ public class FlatButtonUI
|
||||
return instance;
|
||||
}
|
||||
|
||||
static boolean isContentAreaFilled( Component c ) {
|
||||
return c instanceof AbstractButton && ((AbstractButton)c).isContentAreaFilled();
|
||||
}
|
||||
|
||||
static boolean isDefaultButton( Component c ) {
|
||||
return c instanceof JButton && ((JButton)c).isDefaultButton();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update( Graphics g, JComponent c ) {
|
||||
if( c.isOpaque() ) {
|
||||
if( c.isOpaque() && FlatButtonUI.isContentAreaFilled( c ) ) {
|
||||
FlatUIUtils.paintParentBackground( g, c );
|
||||
|
||||
if( c.isEnabled() ) {
|
||||
|
||||
Reference in New Issue
Block a user