mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2026-02-11 06:27:13 -06:00
OptionPane: fixed button order on Mac
This commit is contained in:
@@ -40,6 +40,7 @@ import com.formdev.flatlaf.util.ColorFunctions;
|
||||
import com.formdev.flatlaf.util.DerivedColor;
|
||||
import com.formdev.flatlaf.util.ScaledNumber;
|
||||
import com.formdev.flatlaf.util.StringUtils;
|
||||
import com.formdev.flatlaf.util.SystemInfo;
|
||||
|
||||
/**
|
||||
* Load UI defaults from properties files associated to Flat LaF classes and add to UI defaults.
|
||||
@@ -96,6 +97,27 @@ class UIDefaultsLoader
|
||||
}
|
||||
}
|
||||
|
||||
// collect all platform specific keys (but do not modify properties)
|
||||
ArrayList<String> platformSpecificKeys = new ArrayList<>();
|
||||
for( Object key : properties.keySet() ) {
|
||||
if( ((String)key).startsWith( "[" ) )
|
||||
platformSpecificKeys.add( (String) key );
|
||||
}
|
||||
|
||||
// remove platform specific properties and re-add only properties
|
||||
// for current platform, but with platform prefix removed
|
||||
if( !platformSpecificKeys.isEmpty() ) {
|
||||
String platformPrefix =
|
||||
SystemInfo.IS_WINDOWS ? "[win]" :
|
||||
SystemInfo.IS_MAC ? "[mac]" :
|
||||
SystemInfo.IS_LINUX ? "[linux]" : "[unknown]";
|
||||
for( String key : platformSpecificKeys ) {
|
||||
Object value = properties.remove( key );
|
||||
if( key.startsWith( platformPrefix ) )
|
||||
properties.put( key.substring( platformPrefix.length() ), value );
|
||||
}
|
||||
}
|
||||
|
||||
Function<String, String> resolver = value -> {
|
||||
return resolveValue( properties, value );
|
||||
};
|
||||
|
||||
@@ -206,6 +206,7 @@ OptionPane.buttonMinimumWidth={scaledNumber}72
|
||||
OptionPane.sameSizeButtons=true
|
||||
OptionPane.setButtonMargin=false
|
||||
OptionPane.buttonOrientation=4
|
||||
[mac]OptionPane.isYesLast=true
|
||||
|
||||
OptionPane.errorIcon=com.formdev.flatlaf.icons.FlatOptionPaneErrorIcon
|
||||
OptionPane.informationIcon=com.formdev.flatlaf.icons.FlatOptionPaneInformationIcon
|
||||
|
||||
Reference in New Issue
Block a user