mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2025-12-06 05:50:53 +03:00
Update FlatRadioButtonUI.java
The method applyStyleProperty of class FlatRadioButtonUI currently styles the variable icon, a field of the parent class BasicRadioButtonUI and the default icon which is set with UIManager.getIcon in method installDefaults. So the wrong icon is styled if someone subclasses FlatRadioBoxIcon or FlatCheckBoxIcon and sets this as the new icon for a JRadioButton or JCheckBox instance. (An example why someone would do so is shown in issue #413). With this change styling takes account of the current icon of a JRadioButton or JCheckBox.
This commit is contained in:
@@ -203,10 +203,15 @@ public class FlatRadioButtonUI
|
|||||||
protected Object applyStyleProperty( AbstractButton b, String key, Object value ) {
|
protected Object applyStyleProperty( AbstractButton b, String key, Object value ) {
|
||||||
// style icon
|
// style icon
|
||||||
if( key.startsWith( "icon." ) ) {
|
if( key.startsWith( "icon." ) ) {
|
||||||
if( !(icon instanceof FlatCheckBoxIcon) )
|
Icon styleIcon = b.getIcon();
|
||||||
|
|
||||||
|
if (styleIcon == null)
|
||||||
|
styleIcon = icon;
|
||||||
|
|
||||||
|
if( !(styleIcon instanceof FlatCheckBoxIcon) )
|
||||||
return new UnknownStyleException( key );
|
return new UnknownStyleException( key );
|
||||||
|
|
||||||
if( iconShared ) {
|
if( styleIcon == icon && iconShared ) {
|
||||||
icon = FlatStylingSupport.cloneIcon( icon );
|
icon = FlatStylingSupport.cloneIcon( icon );
|
||||||
iconShared = false;
|
iconShared = false;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user