mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2026-02-11 06:27:13 -06:00
made JButton, JCheckBox, JRadioButton, JToggleButton and JSlider non-opaque (#20)
This commit is contained in:
@@ -6,6 +6,8 @@ FlatLaf Change Log
|
||||
- Made some fixes for right-to-left support in ComboBox, Slider and ToolTip.
|
||||
(issue #18)
|
||||
- Fixed Java 9 module descriptor (broken since 0.14).
|
||||
- Made `JButton`, `JCheckBox`, `JRadioButton`, `JToggleButton` and `JSlider`
|
||||
non-opaque. (issue #20)
|
||||
|
||||
|
||||
## 0.15
|
||||
|
||||
@@ -131,6 +131,7 @@ public class FlatButtonUI
|
||||
defaults_initialized = true;
|
||||
}
|
||||
|
||||
LookAndFeel.installProperty( b, "opaque", false );
|
||||
LookAndFeel.installProperty( b, "iconTextGap", scale( iconTextGap ) );
|
||||
|
||||
MigLayoutVisualPadding.install( b, focusWidth );
|
||||
@@ -169,15 +170,16 @@ public class FlatButtonUI
|
||||
|
||||
@Override
|
||||
public void update( Graphics g, JComponent c ) {
|
||||
if( isHelpButton( c ) ) {
|
||||
// fill background if opaque to avoid garbage if user sets opaque to true
|
||||
if( c.isOpaque() )
|
||||
FlatUIUtils.paintParentBackground( g, c );
|
||||
|
||||
if( isHelpButton( c ) ) {
|
||||
helpButtonIcon.paintIcon( c, g, 0, 0 );
|
||||
return;
|
||||
}
|
||||
|
||||
if( c.isOpaque() && isContentAreaFilled( c ) ) {
|
||||
FlatUIUtils.paintParentBackground( g, c );
|
||||
|
||||
if( isContentAreaFilled( c ) ) {
|
||||
Color background = getBackground( c );
|
||||
if( background != null ) {
|
||||
Graphics2D g2 = (Graphics2D) g.create();
|
||||
|
||||
@@ -66,6 +66,7 @@ public class FlatRadioButtonUI
|
||||
defaults_initialized = true;
|
||||
}
|
||||
|
||||
LookAndFeel.installProperty( b, "opaque", false );
|
||||
LookAndFeel.installProperty( b, "iconTextGap", scale( iconTextGap ) );
|
||||
|
||||
MigLayoutVisualPadding.install( b, null );
|
||||
|
||||
@@ -25,6 +25,7 @@ import java.awt.geom.Path2D;
|
||||
import java.awt.geom.RoundRectangle2D;
|
||||
import javax.swing.JComponent;
|
||||
import javax.swing.JSlider;
|
||||
import javax.swing.LookAndFeel;
|
||||
import javax.swing.UIManager;
|
||||
import javax.swing.plaf.ComponentUI;
|
||||
import javax.swing.plaf.basic.BasicSliderUI;
|
||||
@@ -96,6 +97,8 @@ public class FlatSliderUI
|
||||
protected void installDefaults( JSlider slider ) {
|
||||
super.installDefaults( slider );
|
||||
|
||||
LookAndFeel.installProperty( slider, "opaque", false );
|
||||
|
||||
trackWidth = UIManager.getInt( "Slider.trackWidth" );
|
||||
thumbWidth = UIManager.getInt( "Slider.thumbWidth" );
|
||||
|
||||
|
||||
Reference in New Issue
Block a user