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
|
@Override
|
||||||
public void paintBorder( Component c, Graphics g, int x, int y, int width, int height ) {
|
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();
|
Graphics2D g2 = (Graphics2D) g.create();
|
||||||
try {
|
try {
|
||||||
FlatUIUtils.setRenderingHints( g2 );
|
FlatUIUtils.setRenderingHints( g2 );
|
||||||
|
|||||||
@@ -47,13 +47,17 @@ public class FlatButtonUI
|
|||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static boolean isContentAreaFilled( Component c ) {
|
||||||
|
return c instanceof AbstractButton && ((AbstractButton)c).isContentAreaFilled();
|
||||||
|
}
|
||||||
|
|
||||||
static boolean isDefaultButton( Component c ) {
|
static boolean isDefaultButton( Component c ) {
|
||||||
return c instanceof JButton && ((JButton)c).isDefaultButton();
|
return c instanceof JButton && ((JButton)c).isDefaultButton();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void update( Graphics g, JComponent c ) {
|
public void update( Graphics g, JComponent c ) {
|
||||||
if( c.isOpaque() ) {
|
if( c.isOpaque() && FlatButtonUI.isContentAreaFilled( c ) ) {
|
||||||
FlatUIUtils.paintParentBackground( g, c );
|
FlatUIUtils.paintParentBackground( g, c );
|
||||||
|
|
||||||
if( c.isEnabled() ) {
|
if( c.isEnabled() ) {
|
||||||
|
|||||||
Reference in New Issue
Block a user