mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2025-12-07 22:40:53 +03:00
Table: fixed selection background of checkbox in table cell
This commit is contained in:
@@ -4,6 +4,7 @@ FlatLaf Change Log
|
|||||||
## Unreleased
|
## Unreleased
|
||||||
|
|
||||||
- Support using IntelliJ platform themes (.theme.json files).
|
- Support using IntelliJ platform themes (.theme.json files).
|
||||||
|
- Fixed selection background of checkbox in table cell.
|
||||||
|
|
||||||
|
|
||||||
## 0.18
|
## 0.18
|
||||||
|
|||||||
@@ -21,10 +21,12 @@ import java.awt.Color;
|
|||||||
import java.awt.Graphics;
|
import java.awt.Graphics;
|
||||||
import java.awt.Rectangle;
|
import java.awt.Rectangle;
|
||||||
import javax.swing.AbstractButton;
|
import javax.swing.AbstractButton;
|
||||||
|
import javax.swing.CellRendererPane;
|
||||||
import javax.swing.JComponent;
|
import javax.swing.JComponent;
|
||||||
import javax.swing.LookAndFeel;
|
import javax.swing.LookAndFeel;
|
||||||
import javax.swing.UIManager;
|
import javax.swing.UIManager;
|
||||||
import javax.swing.plaf.ComponentUI;
|
import javax.swing.plaf.ComponentUI;
|
||||||
|
import javax.swing.plaf.UIResource;
|
||||||
import javax.swing.plaf.basic.BasicRadioButtonUI;
|
import javax.swing.plaf.basic.BasicRadioButtonUI;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -90,6 +92,21 @@ public class FlatRadioButtonUI
|
|||||||
defaults_initialized = false;
|
defaults_initialized = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void paint( Graphics g, JComponent c ) {
|
||||||
|
// fill background even if opaque if
|
||||||
|
// - used as cell renderer (because of selection background)
|
||||||
|
// - if background was explicitly set to a non-UIResource color
|
||||||
|
if( !c.isOpaque() &&
|
||||||
|
(c.getParent() instanceof CellRendererPane || !(c.getBackground() instanceof UIResource)) )
|
||||||
|
{
|
||||||
|
g.setColor( c.getBackground() );
|
||||||
|
g.fillRect( 0, 0, c.getWidth(), c.getHeight() );
|
||||||
|
}
|
||||||
|
|
||||||
|
super.paint( g, c );
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void paintText( Graphics g, AbstractButton b, Rectangle textRect, String text ) {
|
protected void paintText( Graphics g, AbstractButton b, Rectangle textRect, String text ) {
|
||||||
FlatButtonUI.paintText( g, b, textRect, text, b.isEnabled() ? b.getForeground() : disabledText );
|
FlatButtonUI.paintText( g, b, textRect, text, b.isEnabled() ? b.getForeground() : disabledText );
|
||||||
|
|||||||
Reference in New Issue
Block a user