diff --git a/flatlaf-core/src/main/java/com/formdev/flatlaf/UIDefaultsLoader.java b/flatlaf-core/src/main/java/com/formdev/flatlaf/UIDefaultsLoader.java index 66460520..f020a708 100644 --- a/flatlaf-core/src/main/java/com/formdev/flatlaf/UIDefaultsLoader.java +++ b/flatlaf-core/src/main/java/com/formdev/flatlaf/UIDefaultsLoader.java @@ -340,6 +340,7 @@ class UIDefaultsLoader private static ValueType[] tempResultValueType = new ValueType[1]; private static Map, ValueType> javaValueTypes; + private static Map knownValueTypes; static Object parseValue( String key, String value, Class valueType ) { return parseValue( key, value, valueType, null, v -> v, Collections.emptyList() ); @@ -446,6 +447,28 @@ class UIDefaultsLoader } } + if( valueType == ValueType.UNKNOWN ) { + if( knownValueTypes == null ) { + // create lazy + knownValueTypes = new HashMap<>(); + // SplitPane + knownValueTypes.put( "SplitPane.dividerSize", ValueType.INTEGER ); + knownValueTypes.put( "SplitPaneDivider.gripDotSize", ValueType.INTEGER ); + knownValueTypes.put( "dividerSize", ValueType.INTEGER ); + knownValueTypes.put( "gripDotSize", ValueType.INTEGER ); + // TabbedPane + knownValueTypes.put( "TabbedPane.closeCrossPlainSize", ValueType.FLOAT ); + knownValueTypes.put( "TabbedPane.closeCrossFilledSize", ValueType.FLOAT ); + knownValueTypes.put( "closeCrossPlainSize", ValueType.FLOAT ); + knownValueTypes.put( "closeCrossFilledSize", ValueType.FLOAT ); + // Table + knownValueTypes.put( "Table.intercellSpacing", ValueType.DIMENSION ); + knownValueTypes.put( "intercellSpacing", ValueType.DIMENSION ); + } + + valueType = knownValueTypes.getOrDefault( key, ValueType.UNKNOWN ); + } + // determine value type from key if( valueType == ValueType.UNKNOWN ) { if( key.endsWith( "UI" ) ) diff --git a/flatlaf-core/src/main/resources/com/formdev/flatlaf/FlatLaf.properties b/flatlaf-core/src/main/resources/com/formdev/flatlaf/FlatLaf.properties index 6b574866..3f457347 100644 --- a/flatlaf-core/src/main/resources/com/formdev/flatlaf/FlatLaf.properties +++ b/flatlaf-core/src/main/resources/com/formdev/flatlaf/FlatLaf.properties @@ -563,7 +563,7 @@ Spinner.buttonStyle = button #---- SplitPane ---- -SplitPane.dividerSize = {integer}5 +SplitPane.dividerSize = 5 SplitPane.continuousLayout = true SplitPane.border = null SplitPane.centerOneTouchButtons = true @@ -578,7 +578,7 @@ SplitPaneDivider.oneTouchPressedArrowColor = @buttonPressedArrowColor SplitPaneDivider.style = grip SplitPaneDivider.gripColor = @icon SplitPaneDivider.gripDotCount = 3 -SplitPaneDivider.gripDotSize = {integer}3 +SplitPaneDivider.gripDotSize = 3 SplitPaneDivider.gripGap = 2 @@ -624,7 +624,7 @@ TabbedPane.scrollButtonsPlacement = both TabbedPane.closeIcon = com.formdev.flatlaf.icons.FlatTabbedPaneCloseIcon TabbedPane.closeSize = 16,16 TabbedPane.closeArc = 4 -TabbedPane.closeCrossPlainSize = {float}7.5 +TabbedPane.closeCrossPlainSize = 7.5 TabbedPane.closeCrossFilledSize = $TabbedPane.closeCrossPlainSize TabbedPane.closeCrossLineWidth = 1 @@ -636,7 +636,7 @@ Table.showHorizontalLines = false Table.showVerticalLines = false Table.showTrailingVerticalLine = false Table.consistentHomeEndKeyBehavior = true -Table.intercellSpacing = {dimension}0,0 +Table.intercellSpacing = 0,0 Table.scrollPaneBorder = com.formdev.flatlaf.ui.FlatBorder Table.ascendingSortIcon = com.formdev.flatlaf.icons.FlatAscendingSortIcon Table.descendingSortIcon = com.formdev.flatlaf.icons.FlatDescendingSortIcon diff --git a/flatlaf-core/src/test/java/com/formdev/flatlaf/ui/TestFlatStyling.java b/flatlaf-core/src/test/java/com/formdev/flatlaf/ui/TestFlatStyling.java index 23a598d9..d8147afd 100644 --- a/flatlaf-core/src/test/java/com/formdev/flatlaf/ui/TestFlatStyling.java +++ b/flatlaf-core/src/test/java/com/formdev/flatlaf/ui/TestFlatStyling.java @@ -800,7 +800,7 @@ public class TestFlatStyling ui.applyStyle( "style: grip" ); ui.applyStyle( "gripColor: #fff" ); ui.applyStyle( "gripDotCount: 3" ); - ui.applyStyle( "gripDotSize: {integer}3" ); + ui.applyStyle( "gripDotSize: 3" ); ui.applyStyle( "gripGap: 2" ); // JComponent properties @@ -809,7 +809,7 @@ public class TestFlatStyling ui.applyStyle( "border: 2,2,2,2,#f00" ); // JSplitPane properties - ui.applyStyle( "dividerSize: {integer}20" ); + ui.applyStyle( "dividerSize: 20" ); } @Test @@ -867,8 +867,8 @@ public class TestFlatStyling // FlatTabbedPaneCloseIcon ui.applyStyle( "closeSize: 16,16" ); ui.applyStyle( "closeArc: 4" ); - ui.applyStyle( "closeCrossPlainSize: {float}7.5" ); - ui.applyStyle( "closeCrossFilledSize: {float}7.5" ); + ui.applyStyle( "closeCrossPlainSize: 7.5" ); + ui.applyStyle( "closeCrossFilledSize: 7.5" ); ui.applyStyle( "closeCrossLineWidth: 1" ); ui.applyStyle( "closeBackground: #fff" ); ui.applyStyle( "closeForeground: #fff" ); @@ -911,7 +911,7 @@ public class TestFlatStyling ui.applyStyle( "rowHeight: 30" ); ui.applyStyle( "showHorizontalLines: true" ); ui.applyStyle( "showVerticalLines: true" ); - ui.applyStyle( "intercellSpacing: {dimension}1,1" ); + ui.applyStyle( "intercellSpacing: 1,1" ); } @Test diff --git a/flatlaf-testing/src/main/resources/com/formdev/flatlaf/testing/FlatTestLaf.properties b/flatlaf-testing/src/main/resources/com/formdev/flatlaf/testing/FlatTestLaf.properties index ba5dd9fd..7dea8c35 100644 --- a/flatlaf-testing/src/main/resources/com/formdev/flatlaf/testing/FlatTestLaf.properties +++ b/flatlaf-testing/src/main/resources/com/formdev/flatlaf/testing/FlatTestLaf.properties @@ -342,8 +342,8 @@ TabbedPane.buttonPressedBackground = #FFC800 TabbedPane.closeSize = 16,16 TabbedPane.closeArc = 999 -TabbedPane.closeCrossPlainSize = {float}12 -TabbedPane.closeCrossFilledSize = {float}6.5 +TabbedPane.closeCrossPlainSize = 12 +TabbedPane.closeCrossFilledSize = 6.5 TabbedPane.closeCrossLineWidth = 2 #TabbedPane.closeBackground = #faa TabbedPane.closeForeground = #f00