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