Styling: fixed detection of value type if key prefix ix given (e.g. [light]padding)

This commit is contained in:
Karl Tauber
2021-07-05 22:40:55 +02:00
parent 84f7e244f2
commit ac291b688d

View File

@@ -114,6 +114,7 @@ public class FlatStyleSupport
String key = e.getKey();
Object newValue = e.getValue();
// handle key prefix
if( key.startsWith( "[" ) ) {
if( (SystemInfo.isWindows && key.startsWith( "[win]" )) ||
(SystemInfo.isMacOS && key.startsWith( "[mac]" )) ||
@@ -182,6 +183,11 @@ public class FlatStyleSupport
if( value.startsWith( "$" ) )
return UIManager.get( value.substring( 1 ) );
// remove key prefix for correct value type detection
// (e.g. "[light]padding" would not parse to Insets)
if( key.startsWith( "[" ) )
key = key.substring( key.indexOf( ']' ) + 1 );
return FlatLaf.parseDefaultsValue( key, value );
}