From 58fa2a50858972d9b4f23994140ec849d9e159ec Mon Sep 17 00:00:00 2001 From: Karl Tauber Date: Tue, 10 Dec 2024 19:49:46 +0100 Subject: [PATCH] Demo, Testing, Theme Editor: re-generated UI code using JFormDesigner 8.3, which now supports class `FlatClientProperties` --- .../flatlaf/demo/BasicComponentsPanel.java | 56 ++++----- .../flatlaf/demo/MoreComponentsPanel.java | 17 +-- .../com/formdev/flatlaf/demo/TabsPanel.java | 85 ++++++------- .../demo/intellijthemes/IJThemesPanel.java | 3 +- .../jideoss/FlatJideOssDefaultsAddon.java | 5 +- .../testing/FlatComponentStateTest.java | 74 +++++------ .../testing/FlatCustomBordersTest.java | 59 ++++----- .../flatlaf/testing/FlatFontsTest.java | 3 +- .../flatlaf/testing/FlatTestFrame.java | 3 +- .../testing/FlatTextComponentsTest.java | 14 +-- .../flatlaf/testing/FlatTypographyTest.java | 25 ++-- .../testing/FlatWindowDecorationsTest.java | 4 +- .../flatlaf/themeeditor/FlatThemePreview.java | 3 +- .../themeeditor/FlatThemePreviewAll.java | 118 +++++++++--------- .../themeeditor/FlatThemePreviewButtons.java | 99 +++++++-------- .../themeeditor/FlatThemePreviewFonts.java | 8 +- .../themeeditor/FlatThemePreviewSwitches.java | 34 ++--- 17 files changed, 310 insertions(+), 300 deletions(-) diff --git a/flatlaf-demo/src/main/java/com/formdev/flatlaf/demo/BasicComponentsPanel.java b/flatlaf-demo/src/main/java/com/formdev/flatlaf/demo/BasicComponentsPanel.java index 7a7e2d61..8983809c 100644 --- a/flatlaf-demo/src/main/java/com/formdev/flatlaf/demo/BasicComponentsPanel.java +++ b/flatlaf-demo/src/main/java/com/formdev/flatlaf/demo/BasicComponentsPanel.java @@ -277,22 +277,22 @@ class BasicComponentsPanel //---- button5 ---- button5.setText("Square"); - button5.putClientProperty("JButton.buttonType", "square"); + button5.putClientProperty(FlatClientProperties.BUTTON_TYPE, FlatClientProperties.BUTTON_TYPE_SQUARE); add(button5, "cell 3 1"); //---- button6 ---- button6.setText("Round"); - button6.putClientProperty("JButton.buttonType", "roundRect"); + button6.putClientProperty(FlatClientProperties.BUTTON_TYPE, FlatClientProperties.BUTTON_TYPE_ROUND_RECT); add(button6, "cell 4 1"); //---- button3 ---- button3.setText("Help"); - button3.putClientProperty("JButton.buttonType", "help"); + button3.putClientProperty(FlatClientProperties.BUTTON_TYPE, FlatClientProperties.BUTTON_TYPE_HELP); add(button3, "cell 4 1"); //---- button4 ---- button4.setText("Help"); - button4.putClientProperty("JButton.buttonType", "help"); + button4.putClientProperty(FlatClientProperties.BUTTON_TYPE, FlatClientProperties.BUTTON_TYPE_HELP); button4.setEnabled(false); add(button4, "cell 4 1"); @@ -432,7 +432,7 @@ class BasicComponentsPanel //---- comboBox6 ---- comboBox6.setEditable(true); - comboBox6.putClientProperty("JTextField.placeholderText", "Placeholder"); + comboBox6.putClientProperty(FlatClientProperties.PLACEHOLDER_TEXT, "Placeholder"); add(comboBox6, "cell 5 5,growx"); //---- textFieldLabel ---- @@ -463,7 +463,7 @@ class BasicComponentsPanel add(textField4, "cell 4 6,growx"); //---- textField6 ---- - textField6.putClientProperty("JTextField.placeholderText", "Placeholder"); + textField6.putClientProperty(FlatClientProperties.PLACEHOLDER_TEXT, "Placeholder"); add(textField6, "cell 5 6,growx"); //---- formattedTextFieldLabel ---- @@ -494,7 +494,7 @@ class BasicComponentsPanel add(formattedTextField4, "cell 4 7,growx"); //---- formattedTextField5 ---- - formattedTextField5.putClientProperty("JTextField.placeholderText", "Placeholder"); + formattedTextField5.putClientProperty(FlatClientProperties.PLACEHOLDER_TEXT, "Placeholder"); add(formattedTextField5, "cell 5 7,growx"); //---- passwordFieldLabel ---- @@ -522,7 +522,7 @@ class BasicComponentsPanel add(passwordField4, "cell 4 8,growx"); //---- passwordField5 ---- - passwordField5.putClientProperty("JTextField.placeholderText", "Placeholder"); + passwordField5.putClientProperty(FlatClientProperties.PLACEHOLDER_TEXT, "Placeholder"); add(passwordField5, "cell 5 8,growx"); //---- textAreaLabel ---- @@ -703,11 +703,11 @@ class BasicComponentsPanel add(errorHintsLabel, "cell 0 12"); //---- errorHintsTextField ---- - errorHintsTextField.putClientProperty("JComponent.outline", "error"); + errorHintsTextField.putClientProperty(FlatClientProperties.OUTLINE, FlatClientProperties.OUTLINE_ERROR); add(errorHintsTextField, "cell 1 12,growx"); //---- errorHintsComboBox ---- - errorHintsComboBox.putClientProperty("JComponent.outline", "error"); + errorHintsComboBox.putClientProperty(FlatClientProperties.OUTLINE, FlatClientProperties.OUTLINE_ERROR); errorHintsComboBox.setModel(new DefaultComboBoxModel<>(new String[] { "Editable" })); @@ -715,7 +715,7 @@ class BasicComponentsPanel add(errorHintsComboBox, "cell 2 12,growx"); //---- errorHintsSpinner ---- - errorHintsSpinner.putClientProperty("JComponent.outline", "error"); + errorHintsSpinner.putClientProperty(FlatClientProperties.OUTLINE, FlatClientProperties.OUTLINE_ERROR); add(errorHintsSpinner, "cell 3 12,growx"); //---- warningHintsLabel ---- @@ -723,18 +723,18 @@ class BasicComponentsPanel add(warningHintsLabel, "cell 0 13"); //---- warningHintsTextField ---- - warningHintsTextField.putClientProperty("JComponent.outline", "warning"); + warningHintsTextField.putClientProperty(FlatClientProperties.OUTLINE, FlatClientProperties.OUTLINE_WARNING); add(warningHintsTextField, "cell 1 13,growx"); //---- warningHintsComboBox ---- - warningHintsComboBox.putClientProperty("JComponent.outline", "warning"); + warningHintsComboBox.putClientProperty(FlatClientProperties.OUTLINE, FlatClientProperties.OUTLINE_WARNING); warningHintsComboBox.setModel(new DefaultComboBoxModel<>(new String[] { "Not editable" })); add(warningHintsComboBox, "cell 2 13,growx"); //---- warningHintsSpinner ---- - warningHintsSpinner.putClientProperty("JComponent.outline", "warning"); + warningHintsSpinner.putClientProperty(FlatClientProperties.OUTLINE, FlatClientProperties.OUTLINE_WARNING); add(warningHintsSpinner, "cell 3 13,growx"); //---- iconsLabel ---- @@ -765,53 +765,53 @@ class BasicComponentsPanel //---- h00Label ---- h00Label.setText("H00"); - h00Label.putClientProperty("FlatLaf.styleClass", "h00"); + h00Label.putClientProperty(FlatClientProperties.STYLE_CLASS, "h00"); add(h00Label, "cell 1 16 5 1"); //---- h0Label ---- h0Label.setText("H0"); - h0Label.putClientProperty("FlatLaf.styleClass", "h0"); + h0Label.putClientProperty(FlatClientProperties.STYLE_CLASS, "h0"); add(h0Label, "cell 1 16 5 1"); //---- h1Label ---- h1Label.setText("H1"); - h1Label.putClientProperty("FlatLaf.styleClass", "h1"); + h1Label.putClientProperty(FlatClientProperties.STYLE_CLASS, "h1"); add(h1Label, "cell 1 16 5 1"); //---- h2Label ---- h2Label.setText("H2"); - h2Label.putClientProperty("FlatLaf.styleClass", "h2"); + h2Label.putClientProperty(FlatClientProperties.STYLE_CLASS, "h2"); add(h2Label, "cell 1 16 5 1"); //---- h3Label ---- h3Label.setText("H3"); - h3Label.putClientProperty("FlatLaf.styleClass", "h3"); + h3Label.putClientProperty(FlatClientProperties.STYLE_CLASS, "h3"); add(h3Label, "cell 1 16 5 1"); //---- h4Label ---- h4Label.setText("H4"); - h4Label.putClientProperty("FlatLaf.styleClass", "h4"); + h4Label.putClientProperty(FlatClientProperties.STYLE_CLASS, "h4"); add(h4Label, "cell 1 16 5 1"); //---- lightLabel ---- lightLabel.setText("light"); - lightLabel.putClientProperty("FlatLaf.style", "font: 200% $light.font"); + lightLabel.putClientProperty(FlatClientProperties.STYLE, "font: 200% $light.font"); add(lightLabel, "cell 1 16 5 1,gapx 30"); //---- semiboldLabel ---- semiboldLabel.setText("semibold"); - semiboldLabel.putClientProperty("FlatLaf.style", "font: 200% $semibold.font"); + semiboldLabel.putClientProperty(FlatClientProperties.STYLE, "font: 200% $semibold.font"); add(semiboldLabel, "cell 1 16 5 1"); //---- fontZoomLabel ---- fontZoomLabel.setText("(200%)"); - fontZoomLabel.putClientProperty("FlatLaf.styleClass", "small"); + fontZoomLabel.putClientProperty(FlatClientProperties.STYLE_CLASS, "small"); fontZoomLabel.setEnabled(false); add(fontZoomLabel, "cell 1 16 5 1"); //---- largeLabel ---- largeLabel.setText("large"); - largeLabel.putClientProperty("FlatLaf.styleClass", "large"); + largeLabel.putClientProperty(FlatClientProperties.STYLE_CLASS, "large"); add(largeLabel, "cell 1 17 5 1"); //---- defaultLabel ---- @@ -820,22 +820,22 @@ class BasicComponentsPanel //---- mediumLabel ---- mediumLabel.setText("medium"); - mediumLabel.putClientProperty("FlatLaf.styleClass", "medium"); + mediumLabel.putClientProperty(FlatClientProperties.STYLE_CLASS, "medium"); add(mediumLabel, "cell 1 17 5 1"); //---- smallLabel ---- smallLabel.setText("small"); - smallLabel.putClientProperty("FlatLaf.styleClass", "small"); + smallLabel.putClientProperty(FlatClientProperties.STYLE_CLASS, "small"); add(smallLabel, "cell 1 17 5 1"); //---- miniLabel ---- miniLabel.setText("mini"); - miniLabel.putClientProperty("FlatLaf.styleClass", "mini"); + miniLabel.putClientProperty(FlatClientProperties.STYLE_CLASS, "mini"); add(miniLabel, "cell 1 17 5 1"); //---- monospacedLabel ---- monospacedLabel.setText("monospaced"); - monospacedLabel.putClientProperty("FlatLaf.styleClass", "monospaced"); + monospacedLabel.putClientProperty(FlatClientProperties.STYLE_CLASS, "monospaced"); add(monospacedLabel, "cell 1 17 5 1,gapx 30"); //======== popupMenu1 ======== diff --git a/flatlaf-demo/src/main/java/com/formdev/flatlaf/demo/MoreComponentsPanel.java b/flatlaf-demo/src/main/java/com/formdev/flatlaf/demo/MoreComponentsPanel.java index 2728226c..7201e386 100644 --- a/flatlaf-demo/src/main/java/com/formdev/flatlaf/demo/MoreComponentsPanel.java +++ b/flatlaf-demo/src/main/java/com/formdev/flatlaf/demo/MoreComponentsPanel.java @@ -19,6 +19,7 @@ package com.formdev.flatlaf.demo; import java.awt.*; import javax.swing.*; import javax.swing.border.*; +import com.formdev.flatlaf.FlatClientProperties; import net.miginfocom.swing.*; /** @@ -176,12 +177,12 @@ class MoreComponentsPanel add(scrollBar3, "cell 2 0 1 6,growy"); //---- scrollBar7 ---- - scrollBar7.putClientProperty("JScrollBar.showButtons", true); + scrollBar7.putClientProperty(FlatClientProperties.SCROLL_BAR_SHOW_BUTTONS, true); add(scrollBar7, "cell 2 0 1 6,growy"); //---- scrollBar8 ---- scrollBar8.setEnabled(false); - scrollBar8.putClientProperty("JScrollBar.showButtons", true); + scrollBar8.putClientProperty(FlatClientProperties.SCROLL_BAR_SHOW_BUTTONS, true); add(scrollBar8, "cell 2 0 1 6,growy"); //---- separator2 ---- @@ -301,13 +302,13 @@ class MoreComponentsPanel //---- scrollBar5 ---- scrollBar5.setOrientation(Adjustable.HORIZONTAL); - scrollBar5.putClientProperty("JScrollBar.showButtons", true); + scrollBar5.putClientProperty(FlatClientProperties.SCROLL_BAR_SHOW_BUTTONS, true); add(scrollBar5, "cell 1 3,growx"); //---- scrollBar6 ---- scrollBar6.setOrientation(Adjustable.HORIZONTAL); scrollBar6.setEnabled(false); - scrollBar6.putClientProperty("JScrollBar.showButtons", true); + scrollBar6.putClientProperty(FlatClientProperties.SCROLL_BAR_SHOW_BUTTONS, true); add(scrollBar6, "cell 1 4,growx"); //---- separatorLabel ---- @@ -518,7 +519,7 @@ class MoreComponentsPanel //======== panel5 ======== { - panel5.putClientProperty("FlatLaf.style", "arc: 16; background: darken($Panel.background,5%)"); + panel5.putClientProperty(FlatClientProperties.STYLE, "arc: 16; background: darken($Panel.background,5%)"); panel5.setLayout(new BorderLayout()); //---- label9 ---- @@ -530,7 +531,7 @@ class MoreComponentsPanel //======== panel4 ======== { - panel4.putClientProperty("FlatLaf.style", "border: 1,1,1,1,@disabledForeground,1,16; background: darken($Panel.background,5%)"); + panel4.putClientProperty(FlatClientProperties.STYLE, "border: 1,1,1,1,@disabledForeground,1,16; background: darken($Panel.background,5%)"); panel4.setLayout(new BorderLayout()); //---- label8 ---- @@ -546,14 +547,14 @@ class MoreComponentsPanel //---- label13 ---- label13.setText("rounded background"); - label13.putClientProperty("FlatLaf.style", "arc: 999; border: 2,10,2,10"); + label13.putClientProperty(FlatClientProperties.STYLE, "arc: 999; border: 2,10,2,10"); label13.setBackground(new Color(0xb8e4f3)); label13.setForeground(new Color(0x135b76)); add(label13, "cell 1 13 4 1"); //---- label10 ---- label10.setText("rounded border"); - label10.putClientProperty("FlatLaf.style", "arc: 999; border: 2,10,2,10,#135b76"); + label10.putClientProperty(FlatClientProperties.STYLE, "arc: 999; border: 2,10,2,10,#135b76"); label10.setBackground(new Color(0xb8e4f3)); label10.setForeground(new Color(0x135b76)); add(label10, "cell 1 13 4 1"); diff --git a/flatlaf-demo/src/main/java/com/formdev/flatlaf/demo/TabsPanel.java b/flatlaf-demo/src/main/java/com/formdev/flatlaf/demo/TabsPanel.java index 769bd334..d2251c06 100644 --- a/flatlaf-demo/src/main/java/com/formdev/flatlaf/demo/TabsPanel.java +++ b/flatlaf-demo/src/main/java/com/formdev/flatlaf/demo/TabsPanel.java @@ -16,6 +16,7 @@ package com.formdev.flatlaf.demo; +import com.formdev.flatlaf.FlatClientProperties; import static com.formdev.flatlaf.FlatClientProperties.*; import java.awt.*; import java.awt.event.MouseEvent; @@ -471,7 +472,7 @@ class TabsPanel //---- tabPlacementLabel ---- tabPlacementLabel.setText("Tab placement"); - tabPlacementLabel.putClientProperty("FlatLaf.styleClass", "h3"); + tabPlacementLabel.putClientProperty(FlatClientProperties.STYLE_CLASS, "h3"); panel1.add(tabPlacementLabel, "cell 0 0"); //======== tabPlacementToolBar ======== @@ -482,38 +483,38 @@ class TabsPanel //---- topPlacementButton ---- topPlacementButton.setText("top"); topPlacementButton.setSelected(true); - topPlacementButton.putClientProperty("FlatLaf.styleClass", "small"); + topPlacementButton.putClientProperty(FlatClientProperties.STYLE_CLASS, "small"); topPlacementButton.addActionListener(e -> tabPlacementChanged()); tabPlacementToolBar.add(topPlacementButton); //---- bottomPlacementButton ---- bottomPlacementButton.setText("bottom"); - bottomPlacementButton.putClientProperty("FlatLaf.styleClass", "small"); + bottomPlacementButton.putClientProperty(FlatClientProperties.STYLE_CLASS, "small"); bottomPlacementButton.addActionListener(e -> tabPlacementChanged()); tabPlacementToolBar.add(bottomPlacementButton); //---- leftPlacementButton ---- leftPlacementButton.setText("left"); - leftPlacementButton.putClientProperty("FlatLaf.styleClass", "small"); + leftPlacementButton.putClientProperty(FlatClientProperties.STYLE_CLASS, "small"); leftPlacementButton.addActionListener(e -> tabPlacementChanged()); tabPlacementToolBar.add(leftPlacementButton); //---- rightPlacementButton ---- rightPlacementButton.setText("right"); - rightPlacementButton.putClientProperty("FlatLaf.styleClass", "small"); + rightPlacementButton.putClientProperty(FlatClientProperties.STYLE_CLASS, "small"); rightPlacementButton.addActionListener(e -> tabPlacementChanged()); tabPlacementToolBar.add(rightPlacementButton); tabPlacementToolBar.addSeparator(); //---- scrollButton ---- scrollButton.setText("scroll"); - scrollButton.putClientProperty("FlatLaf.styleClass", "small"); + scrollButton.putClientProperty(FlatClientProperties.STYLE_CLASS, "small"); scrollButton.addActionListener(e -> scrollChanged()); tabPlacementToolBar.add(scrollButton); //---- borderButton ---- borderButton.setText("border"); - borderButton.putClientProperty("FlatLaf.styleClass", "small"); + borderButton.putClientProperty(FlatClientProperties.STYLE_CLASS, "small"); borderButton.addActionListener(e -> borderChanged()); tabPlacementToolBar.add(borderButton); } @@ -522,7 +523,7 @@ class TabsPanel //---- tabLayoutLabel ---- tabLayoutLabel.setText("Tab layout"); - tabLayoutLabel.putClientProperty("FlatLaf.styleClass", "h3"); + tabLayoutLabel.putClientProperty(FlatClientProperties.STYLE_CLASS, "h3"); panel1.add(tabLayoutLabel, "cell 0 2"); //======== tabLayoutToolBar ======== @@ -533,13 +534,13 @@ class TabsPanel //---- scrollTabLayoutButton ---- scrollTabLayoutButton.setText("scroll"); scrollTabLayoutButton.setSelected(true); - scrollTabLayoutButton.putClientProperty("FlatLaf.styleClass", "small"); + scrollTabLayoutButton.putClientProperty(FlatClientProperties.STYLE_CLASS, "small"); scrollTabLayoutButton.addActionListener(e -> tabLayoutChanged()); tabLayoutToolBar.add(scrollTabLayoutButton); //---- wrapTabLayoutButton ---- wrapTabLayoutButton.setText("wrap"); - wrapTabLayoutButton.putClientProperty("FlatLaf.styleClass", "small"); + wrapTabLayoutButton.putClientProperty(FlatClientProperties.STYLE_CLASS, "small"); wrapTabLayoutButton.addActionListener(e -> tabLayoutChanged()); tabLayoutToolBar.add(wrapTabLayoutButton); } @@ -548,20 +549,20 @@ class TabsPanel //---- scrollLayoutNoteLabel ---- scrollLayoutNoteLabel.setText("(use mouse wheel to scroll; arrow button shows hidden tabs)"); scrollLayoutNoteLabel.setEnabled(false); - scrollLayoutNoteLabel.putClientProperty("FlatLaf.styleClass", "small"); + scrollLayoutNoteLabel.putClientProperty(FlatClientProperties.STYLE_CLASS, "small"); panel1.add(scrollLayoutNoteLabel, "cell 0 3"); //---- wrapLayoutNoteLabel ---- wrapLayoutNoteLabel.setText("(probably better to use scroll layout?)"); wrapLayoutNoteLabel.setEnabled(false); - wrapLayoutNoteLabel.putClientProperty("FlatLaf.styleClass", "small"); + wrapLayoutNoteLabel.putClientProperty(FlatClientProperties.STYLE_CLASS, "small"); panel1.add(wrapLayoutNoteLabel, "cell 0 3"); panel1.add(scrollLayoutTabbedPane, "cell 0 4"); panel1.add(wrapLayoutTabbedPane, "cell 0 4,width 100:100,height pref*2px"); //---- closableTabsLabel ---- closableTabsLabel.setText("Closable tabs"); - closableTabsLabel.putClientProperty("FlatLaf.styleClass", "h3"); + closableTabsLabel.putClientProperty(FlatClientProperties.STYLE_CLASS, "h3"); panel1.add(closableTabsLabel, "cell 0 5"); //======== closableTabsToolBar ======== @@ -572,19 +573,19 @@ class TabsPanel //---- squareCloseButton ---- squareCloseButton.setText("square"); squareCloseButton.setSelected(true); - squareCloseButton.putClientProperty("FlatLaf.styleClass", "small"); + squareCloseButton.putClientProperty(FlatClientProperties.STYLE_CLASS, "small"); squareCloseButton.addActionListener(e -> closeButtonStyleChanged()); closableTabsToolBar.add(squareCloseButton); //---- circleCloseButton ---- circleCloseButton.setText("circle"); - circleCloseButton.putClientProperty("FlatLaf.styleClass", "small"); + circleCloseButton.putClientProperty(FlatClientProperties.STYLE_CLASS, "small"); circleCloseButton.addActionListener(e -> closeButtonStyleChanged()); closableTabsToolBar.add(circleCloseButton); //---- redCrossCloseButton ---- redCrossCloseButton.setText("red cross"); - redCrossCloseButton.putClientProperty("FlatLaf.styleClass", "small"); + redCrossCloseButton.putClientProperty(FlatClientProperties.STYLE_CLASS, "small"); redCrossCloseButton.addActionListener(e -> closeButtonStyleChanged()); closableTabsToolBar.add(redCrossCloseButton); } @@ -593,7 +594,7 @@ class TabsPanel //---- tabAreaComponentsLabel ---- tabAreaComponentsLabel.setText("Custom tab area components"); - tabAreaComponentsLabel.putClientProperty("FlatLaf.styleClass", "h3"); + tabAreaComponentsLabel.putClientProperty(FlatClientProperties.STYLE_CLASS, "h3"); panel1.add(tabAreaComponentsLabel, "cell 0 7"); //======== tabAreaComponentsToolBar ======== @@ -604,14 +605,14 @@ class TabsPanel //---- leadingComponentButton ---- leadingComponentButton.setText("leading"); leadingComponentButton.setSelected(true); - leadingComponentButton.putClientProperty("FlatLaf.styleClass", "small"); + leadingComponentButton.putClientProperty(FlatClientProperties.STYLE_CLASS, "small"); leadingComponentButton.addActionListener(e -> customComponentsChanged()); tabAreaComponentsToolBar.add(leadingComponentButton); //---- trailingComponentButton ---- trailingComponentButton.setText("trailing"); trailingComponentButton.setSelected(true); - trailingComponentButton.putClientProperty("FlatLaf.styleClass", "small"); + trailingComponentButton.putClientProperty(FlatClientProperties.STYLE_CLASS, "small"); trailingComponentButton.addActionListener(e -> customComponentsChanged()); tabAreaComponentsToolBar.add(trailingComponentButton); } @@ -642,13 +643,13 @@ class TabsPanel //---- tabIconPlacementLabel ---- tabIconPlacementLabel.setText("Tab icon placement"); - tabIconPlacementLabel.putClientProperty("FlatLaf.styleClass", "h3"); + tabIconPlacementLabel.putClientProperty(FlatClientProperties.STYLE_CLASS, "h3"); panel2.add(tabIconPlacementLabel, "cell 0 0"); //---- tabIconPlacementNodeLabel ---- tabIconPlacementNodeLabel.setText("(top/bottom/leading/trailing)"); tabIconPlacementNodeLabel.setEnabled(false); - tabIconPlacementNodeLabel.putClientProperty("FlatLaf.styleClass", "small"); + tabIconPlacementNodeLabel.putClientProperty(FlatClientProperties.STYLE_CLASS, "small"); panel2.add(tabIconPlacementNodeLabel, "cell 0 1"); panel2.add(iconTopTabbedPane, "cell 0 2"); panel2.add(iconBottomTabbedPane, "cell 0 3"); @@ -657,13 +658,13 @@ class TabsPanel //---- tabAreaAlignmentLabel ---- tabAreaAlignmentLabel.setText("Tab area alignment"); - tabAreaAlignmentLabel.putClientProperty("FlatLaf.styleClass", "h3"); + tabAreaAlignmentLabel.putClientProperty(FlatClientProperties.STYLE_CLASS, "h3"); panel2.add(tabAreaAlignmentLabel, "cell 0 6"); //---- tabAreaAlignmentNoteLabel ---- tabAreaAlignmentNoteLabel.setText("(leading/center/trailing/fill)"); tabAreaAlignmentNoteLabel.setEnabled(false); - tabAreaAlignmentNoteLabel.putClientProperty("FlatLaf.styleClass", "small"); + tabAreaAlignmentNoteLabel.putClientProperty(FlatClientProperties.STYLE_CLASS, "small"); panel2.add(tabAreaAlignmentNoteLabel, "cell 0 7"); panel2.add(alignLeadingTabbedPane, "cell 0 8"); panel2.add(alignCenterTabbedPane, "cell 0 9"); @@ -692,13 +693,13 @@ class TabsPanel //---- tabWidthModeLabel ---- tabWidthModeLabel.setText("Tab width mode"); - tabWidthModeLabel.putClientProperty("FlatLaf.styleClass", "h3"); + tabWidthModeLabel.putClientProperty(FlatClientProperties.STYLE_CLASS, "h3"); panel3.add(tabWidthModeLabel, "cell 0 0"); //---- tabWidthModeNoteLabel ---- tabWidthModeNoteLabel.setText("(preferred/equal/compact)"); tabWidthModeNoteLabel.setEnabled(false); - tabWidthModeNoteLabel.putClientProperty("FlatLaf.styleClass", "small"); + tabWidthModeNoteLabel.putClientProperty(FlatClientProperties.STYLE_CLASS, "small"); panel3.add(tabWidthModeNoteLabel, "cell 0 1"); panel3.add(widthPreferredTabbedPane, "cell 0 2"); panel3.add(widthEqualTabbedPane, "cell 0 3"); @@ -706,14 +707,14 @@ class TabsPanel //---- minMaxTabWidthLabel ---- minMaxTabWidthLabel.setText("Minimum/maximum tab width"); - minMaxTabWidthLabel.putClientProperty("FlatLaf.styleClass", "h3"); + minMaxTabWidthLabel.putClientProperty(FlatClientProperties.STYLE_CLASS, "h3"); panel3.add(minMaxTabWidthLabel, "cell 0 5"); panel3.add(minimumTabWidthTabbedPane, "cell 0 6"); panel3.add(maximumTabWidthTabbedPane, "cell 0 7"); //---- tabAlignmentLabel ---- tabAlignmentLabel.setText("Tab title alignment"); - tabAlignmentLabel.putClientProperty("FlatLaf.styleClass", "h3"); + tabAlignmentLabel.putClientProperty(FlatClientProperties.STYLE_CLASS, "h3"); panel3.add(tabAlignmentLabel, "cell 0 8"); //======== panel5 ======== @@ -733,13 +734,13 @@ class TabsPanel //---- tabAlignmentNoteLabel ---- tabAlignmentNoteLabel.setText("(leading/center/trailing)"); tabAlignmentNoteLabel.setEnabled(false); - tabAlignmentNoteLabel.putClientProperty("FlatLaf.styleClass", "small"); + tabAlignmentNoteLabel.putClientProperty(FlatClientProperties.STYLE_CLASS, "small"); panel5.add(tabAlignmentNoteLabel, "cell 0 0"); //---- tabAlignmentNoteLabel2 ---- tabAlignmentNoteLabel2.setText("(trailing)"); tabAlignmentNoteLabel2.setEnabled(false); - tabAlignmentNoteLabel2.putClientProperty("FlatLaf.styleClass", "small"); + tabAlignmentNoteLabel2.putClientProperty(FlatClientProperties.STYLE_CLASS, "small"); panel5.add(tabAlignmentNoteLabel2, "cell 1 0,alignx right,growx 0"); panel5.add(tabAlignLeadingTabbedPane, "cell 0 1"); @@ -787,19 +788,19 @@ class TabsPanel //---- scrollAsNeededSingleButton ---- scrollAsNeededSingleButton.setText("asNeededSingle"); scrollAsNeededSingleButton.setSelected(true); - scrollAsNeededSingleButton.putClientProperty("FlatLaf.styleClass", "small"); + scrollAsNeededSingleButton.putClientProperty(FlatClientProperties.STYLE_CLASS, "small"); scrollAsNeededSingleButton.addActionListener(e -> scrollButtonsPolicyChanged()); scrollButtonsPolicyToolBar.add(scrollAsNeededSingleButton); //---- scrollAsNeededButton ---- scrollAsNeededButton.setText("asNeeded"); - scrollAsNeededButton.putClientProperty("FlatLaf.styleClass", "small"); + scrollAsNeededButton.putClientProperty(FlatClientProperties.STYLE_CLASS, "small"); scrollAsNeededButton.addActionListener(e -> scrollButtonsPolicyChanged()); scrollButtonsPolicyToolBar.add(scrollAsNeededButton); //---- scrollNeverButton ---- scrollNeverButton.setText("never"); - scrollNeverButton.putClientProperty("FlatLaf.styleClass", "small"); + scrollNeverButton.putClientProperty(FlatClientProperties.STYLE_CLASS, "small"); scrollNeverButton.addActionListener(e -> scrollButtonsPolicyChanged()); scrollButtonsPolicyToolBar.add(scrollNeverButton); } @@ -817,13 +818,13 @@ class TabsPanel //---- popupAsNeededButton ---- popupAsNeededButton.setText("asNeeded"); popupAsNeededButton.setSelected(true); - popupAsNeededButton.putClientProperty("FlatLaf.styleClass", "small"); + popupAsNeededButton.putClientProperty(FlatClientProperties.STYLE_CLASS, "small"); popupAsNeededButton.addActionListener(e -> tabsPopupPolicyChanged()); tabsPopupPolicyToolBar.add(popupAsNeededButton); //---- popupNeverButton ---- popupNeverButton.setText("never"); - popupNeverButton.putClientProperty("FlatLaf.styleClass", "small"); + popupNeverButton.putClientProperty(FlatClientProperties.STYLE_CLASS, "small"); popupNeverButton.addActionListener(e -> tabsPopupPolicyChanged()); tabsPopupPolicyToolBar.add(popupNeverButton); } @@ -846,13 +847,13 @@ class TabsPanel //---- scrollBothButton ---- scrollBothButton.setText("both"); scrollBothButton.setSelected(true); - scrollBothButton.putClientProperty("FlatLaf.styleClass", "small"); + scrollBothButton.putClientProperty(FlatClientProperties.STYLE_CLASS, "small"); scrollBothButton.addActionListener(e -> scrollButtonsPlacementChanged()); scrollButtonsPlacementToolBar.add(scrollBothButton); //---- scrollTrailingButton ---- scrollTrailingButton.setText("trailing"); - scrollTrailingButton.putClientProperty("FlatLaf.styleClass", "small"); + scrollTrailingButton.putClientProperty(FlatClientProperties.STYLE_CLASS, "small"); scrollTrailingButton.addActionListener(e -> scrollButtonsPlacementChanged()); scrollButtonsPlacementToolBar.add(scrollTrailingButton); } @@ -869,13 +870,13 @@ class TabsPanel //---- underlinedTabTypeButton ---- underlinedTabTypeButton.setText("underlined"); underlinedTabTypeButton.setSelected(true); - underlinedTabTypeButton.putClientProperty("FlatLaf.styleClass", "small"); + underlinedTabTypeButton.putClientProperty(FlatClientProperties.STYLE_CLASS, "small"); underlinedTabTypeButton.addActionListener(e -> tabTypeChanged()); tabTypeToolBar.add(underlinedTabTypeButton); //---- cardTabTypeButton ---- cardTabTypeButton.setText("card"); - cardTabTypeButton.putClientProperty("FlatLaf.styleClass", "small"); + cardTabTypeButton.putClientProperty(FlatClientProperties.STYLE_CLASS, "small"); cardTabTypeButton.addActionListener(e -> tabTypeChanged()); tabTypeToolBar.add(cardTabTypeButton); } @@ -893,25 +894,25 @@ class TabsPanel //---- rotationNoneButton ---- rotationNoneButton.setText("none"); rotationNoneButton.setSelected(true); - rotationNoneButton.putClientProperty("FlatLaf.styleClass", "small"); + rotationNoneButton.putClientProperty(FlatClientProperties.STYLE_CLASS, "small"); rotationNoneButton.addActionListener(e -> tabRotationChanged()); tabRotationToolBar.add(rotationNoneButton); //---- rotationAutoButton ---- rotationAutoButton.setText("auto"); - rotationAutoButton.putClientProperty("FlatLaf.styleClass", "small"); + rotationAutoButton.putClientProperty(FlatClientProperties.STYLE_CLASS, "small"); rotationAutoButton.addActionListener(e -> tabRotationChanged()); tabRotationToolBar.add(rotationAutoButton); //---- rotationLeftButton ---- rotationLeftButton.setText("left"); - rotationLeftButton.putClientProperty("FlatLaf.styleClass", "small"); + rotationLeftButton.putClientProperty(FlatClientProperties.STYLE_CLASS, "small"); rotationLeftButton.addActionListener(e -> tabRotationChanged()); tabRotationToolBar.add(rotationLeftButton); //---- rotationRightButton ---- rotationRightButton.setText("right"); - rotationRightButton.putClientProperty("FlatLaf.styleClass", "small"); + rotationRightButton.putClientProperty(FlatClientProperties.STYLE_CLASS, "small"); rotationRightButton.addActionListener(e -> tabRotationChanged()); tabRotationToolBar.add(rotationRightButton); } diff --git a/flatlaf-demo/src/main/java/com/formdev/flatlaf/demo/intellijthemes/IJThemesPanel.java b/flatlaf-demo/src/main/java/com/formdev/flatlaf/demo/intellijthemes/IJThemesPanel.java index 1af0f05c..360ac0a1 100644 --- a/flatlaf-demo/src/main/java/com/formdev/flatlaf/demo/intellijthemes/IJThemesPanel.java +++ b/flatlaf-demo/src/main/java/com/formdev/flatlaf/demo/intellijthemes/IJThemesPanel.java @@ -45,6 +45,7 @@ import javax.swing.*; import javax.swing.border.Border; import javax.swing.border.CompoundBorder; import javax.swing.event.*; +import com.formdev.flatlaf.FlatClientProperties; import com.formdev.flatlaf.FlatDarculaLaf; import com.formdev.flatlaf.FlatDarkLaf; import com.formdev.flatlaf.FlatIntelliJLaf; @@ -554,7 +555,7 @@ public class IJThemesPanel "light", "dark" })); - filterComboBox.putClientProperty("JComponent.minimumWidth", 0); + filterComboBox.putClientProperty(FlatClientProperties.MINIMUM_WIDTH, 0); filterComboBox.setFocusable(false); filterComboBox.addActionListener(e -> filterChanged()); add(filterComboBox, "cell 0 0,alignx right,growx 0"); diff --git a/flatlaf-jide-oss/src/main/java/com/formdev/flatlaf/jideoss/FlatJideOssDefaultsAddon.java b/flatlaf-jide-oss/src/main/java/com/formdev/flatlaf/jideoss/FlatJideOssDefaultsAddon.java index 6aa3822a..dadd2ca5 100644 --- a/flatlaf-jide-oss/src/main/java/com/formdev/flatlaf/jideoss/FlatJideOssDefaultsAddon.java +++ b/flatlaf-jide-oss/src/main/java/com/formdev/flatlaf/jideoss/FlatJideOssDefaultsAddon.java @@ -23,6 +23,7 @@ import javax.swing.LookAndFeel; import javax.swing.UIDefaults; import javax.swing.UIManager; import javax.swing.UIDefaults.ActiveValue; +import com.formdev.flatlaf.FlatClientProperties; import com.formdev.flatlaf.FlatDefaultsAddon; import com.formdev.flatlaf.FlatLaf; import com.formdev.flatlaf.jideoss.ui.FlatJidePainter; @@ -55,8 +56,8 @@ public class FlatJideOssDefaultsAddon public void afterDefaultsLoading( LookAndFeel laf, UIDefaults defaults ) { // TristateCheckBox defaults.put( "TristateCheckBox.icon", null ); - defaults.put( "TristateCheckBox.setMixed.clientProperty", new Object[] { "JButton.selectedState", "indeterminate" } ); - defaults.put( "TristateCheckBox.clearMixed.clientProperty", new Object[] { "JButton.selectedState", null } ); + defaults.put( "TristateCheckBox.setMixed.clientProperty", new Object[] { FlatClientProperties.SELECTED_STATE, FlatClientProperties.SELECTED_STATE_INDETERMINATE } ); + defaults.put( "TristateCheckBox.clearMixed.clientProperty", new Object[] { FlatClientProperties.SELECTED_STATE, null } ); } @Override diff --git a/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatComponentStateTest.java b/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatComponentStateTest.java index 8f3b7bf4..ee6979ee 100644 --- a/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatComponentStateTest.java +++ b/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatComponentStateTest.java @@ -198,17 +198,17 @@ public class FlatComponentStateTest //---- label11 ---- label11.setText("JButton"); - label11.putClientProperty("FlatLaf.styleClass", "h3"); + label11.putClientProperty(FlatClientProperties.STYLE_CLASS, "h3"); add(label11, "cell 1 0 2 1"); //---- label12 ---- label12.setText("JToggleButton"); - label12.putClientProperty("FlatLaf.styleClass", "h3"); + label12.putClientProperty(FlatClientProperties.STYLE_CLASS, "h3"); add(label12, "cell 5 0 3 1"); //---- label32 ---- label32.setText("Help Button"); - label32.putClientProperty("FlatLaf.styleClass", "h3"); + label32.putClientProperty(FlatClientProperties.STYLE_CLASS, "h3"); add(label32, "cell 9 0 2 1"); //---- label5 ---- @@ -257,26 +257,26 @@ public class FlatComponentStateTest //---- testStateButton1 ---- testStateButton1.setText("text"); - testStateButton1.putClientProperty("JComponent.minimumWidth", 0); + testStateButton1.putClientProperty(FlatClientProperties.MINIMUM_WIDTH, 0); add(testStateButton1, "cell 1 2"); //---- testStateButton7 ---- testStateButton7.setText("text"); testStateButton7.setStateDefault(true); - testStateButton7.putClientProperty("JComponent.minimumWidth", 0); + testStateButton7.putClientProperty(FlatClientProperties.MINIMUM_WIDTH, 0); add(testStateButton7, "cell 2 2"); //---- testStateButton4 ---- testStateButton4.setText("text"); testStateButton4.setStateFocused(true); - testStateButton4.putClientProperty("JComponent.minimumWidth", 0); + testStateButton4.putClientProperty(FlatClientProperties.MINIMUM_WIDTH, 0); add(testStateButton4, "cell 3 2"); //---- testStateButton10 ---- testStateButton10.setText("text"); testStateButton10.setStateFocused(true); testStateButton10.setStateDefault(true); - testStateButton10.putClientProperty("JComponent.minimumWidth", 0); + testStateButton10.putClientProperty(FlatClientProperties.MINIMUM_WIDTH, 0); add(testStateButton10, "cell 4 2"); //---- testStateToggleButton1 ---- @@ -300,14 +300,14 @@ public class FlatComponentStateTest add(testStateToggleButton12, "cell 8 2"); //---- testStateButton15 ---- - testStateButton15.putClientProperty("JComponent.minimumWidth", 0); - testStateButton15.putClientProperty("JButton.buttonType", "help"); + testStateButton15.putClientProperty(FlatClientProperties.MINIMUM_WIDTH, 0); + testStateButton15.putClientProperty(FlatClientProperties.BUTTON_TYPE, FlatClientProperties.BUTTON_TYPE_HELP); add(testStateButton15, "cell 9 2"); //---- testStateButton19 ---- testStateButton19.setStateFocused(true); - testStateButton19.putClientProperty("JComponent.minimumWidth", 0); - testStateButton19.putClientProperty("JButton.buttonType", "help"); + testStateButton19.putClientProperty(FlatClientProperties.MINIMUM_WIDTH, 0); + testStateButton19.putClientProperty(FlatClientProperties.BUTTON_TYPE, FlatClientProperties.BUTTON_TYPE_HELP); add(testStateButton19, "cell 10 2"); //---- label2 ---- @@ -317,21 +317,21 @@ public class FlatComponentStateTest //---- testStateButton2 ---- testStateButton2.setText("text"); testStateButton2.setStateHover(true); - testStateButton2.putClientProperty("JComponent.minimumWidth", 0); + testStateButton2.putClientProperty(FlatClientProperties.MINIMUM_WIDTH, 0); add(testStateButton2, "cell 1 3"); //---- testStateButton8 ---- testStateButton8.setText("text"); testStateButton8.setStateHover(true); testStateButton8.setStateDefault(true); - testStateButton8.putClientProperty("JComponent.minimumWidth", 0); + testStateButton8.putClientProperty(FlatClientProperties.MINIMUM_WIDTH, 0); add(testStateButton8, "cell 2 3"); //---- testStateButton5 ---- testStateButton5.setText("text"); testStateButton5.setStateHover(true); testStateButton5.setStateFocused(true); - testStateButton5.putClientProperty("JComponent.minimumWidth", 0); + testStateButton5.putClientProperty(FlatClientProperties.MINIMUM_WIDTH, 0); add(testStateButton5, "cell 3 3"); //---- testStateButton11 ---- @@ -339,7 +339,7 @@ public class FlatComponentStateTest testStateButton11.setStateHover(true); testStateButton11.setStateFocused(true); testStateButton11.setStateDefault(true); - testStateButton11.putClientProperty("JComponent.minimumWidth", 0); + testStateButton11.putClientProperty(FlatClientProperties.MINIMUM_WIDTH, 0); add(testStateButton11, "cell 4 3"); //---- testStateToggleButton2 ---- @@ -368,15 +368,15 @@ public class FlatComponentStateTest //---- testStateButton16 ---- testStateButton16.setStateHover(true); - testStateButton16.putClientProperty("JComponent.minimumWidth", 0); - testStateButton16.putClientProperty("JButton.buttonType", "help"); + testStateButton16.putClientProperty(FlatClientProperties.MINIMUM_WIDTH, 0); + testStateButton16.putClientProperty(FlatClientProperties.BUTTON_TYPE, FlatClientProperties.BUTTON_TYPE_HELP); add(testStateButton16, "cell 9 3"); //---- testStateButton20 ---- testStateButton20.setStateHover(true); testStateButton20.setStateFocused(true); - testStateButton20.putClientProperty("JComponent.minimumWidth", 0); - testStateButton20.putClientProperty("JButton.buttonType", "help"); + testStateButton20.putClientProperty(FlatClientProperties.MINIMUM_WIDTH, 0); + testStateButton20.putClientProperty(FlatClientProperties.BUTTON_TYPE, FlatClientProperties.BUTTON_TYPE_HELP); add(testStateButton20, "cell 10 3"); //---- label3 ---- @@ -386,21 +386,21 @@ public class FlatComponentStateTest //---- testStateButton3 ---- testStateButton3.setText("text"); testStateButton3.setStatePressed(true); - testStateButton3.putClientProperty("JComponent.minimumWidth", 0); + testStateButton3.putClientProperty(FlatClientProperties.MINIMUM_WIDTH, 0); add(testStateButton3, "cell 1 4"); //---- testStateButton9 ---- testStateButton9.setText("text"); testStateButton9.setStatePressed(true); testStateButton9.setStateDefault(true); - testStateButton9.putClientProperty("JComponent.minimumWidth", 0); + testStateButton9.putClientProperty(FlatClientProperties.MINIMUM_WIDTH, 0); add(testStateButton9, "cell 2 4"); //---- testStateButton6 ---- testStateButton6.setText("text"); testStateButton6.setStatePressed(true); testStateButton6.setStateFocused(true); - testStateButton6.putClientProperty("JComponent.minimumWidth", 0); + testStateButton6.putClientProperty(FlatClientProperties.MINIMUM_WIDTH, 0); add(testStateButton6, "cell 3 4"); //---- testStateButton12 ---- @@ -408,7 +408,7 @@ public class FlatComponentStateTest testStateButton12.setStatePressed(true); testStateButton12.setStateFocused(true); testStateButton12.setStateDefault(true); - testStateButton12.putClientProperty("JComponent.minimumWidth", 0); + testStateButton12.putClientProperty(FlatClientProperties.MINIMUM_WIDTH, 0); add(testStateButton12, "cell 4 4"); //---- testStateToggleButton3 ---- @@ -437,15 +437,15 @@ public class FlatComponentStateTest //---- testStateButton17 ---- testStateButton17.setStatePressed(true); - testStateButton17.putClientProperty("JComponent.minimumWidth", 0); - testStateButton17.putClientProperty("JButton.buttonType", "help"); + testStateButton17.putClientProperty(FlatClientProperties.MINIMUM_WIDTH, 0); + testStateButton17.putClientProperty(FlatClientProperties.BUTTON_TYPE, FlatClientProperties.BUTTON_TYPE_HELP); add(testStateButton17, "cell 9 4"); //---- testStateButton21 ---- testStateButton21.setStatePressed(true); testStateButton21.setStateFocused(true); - testStateButton21.putClientProperty("JComponent.minimumWidth", 0); - testStateButton21.putClientProperty("JButton.buttonType", "help"); + testStateButton21.putClientProperty(FlatClientProperties.MINIMUM_WIDTH, 0); + testStateButton21.putClientProperty(FlatClientProperties.BUTTON_TYPE, FlatClientProperties.BUTTON_TYPE_HELP); add(testStateButton21, "cell 10 4"); //---- label4 ---- @@ -455,14 +455,14 @@ public class FlatComponentStateTest //---- testStateButton13 ---- testStateButton13.setText("text"); testStateButton13.setEnabled(false); - testStateButton13.putClientProperty("JComponent.minimumWidth", 0); + testStateButton13.putClientProperty(FlatClientProperties.MINIMUM_WIDTH, 0); add(testStateButton13, "cell 1 5"); //---- testStateButton14 ---- testStateButton14.setText("text"); testStateButton14.setEnabled(false); testStateButton14.setStateDefault(true); - testStateButton14.putClientProperty("JComponent.minimumWidth", 0); + testStateButton14.putClientProperty(FlatClientProperties.MINIMUM_WIDTH, 0); add(testStateButton14, "cell 2 5"); //---- testStateToggleButton4 ---- @@ -478,8 +478,8 @@ public class FlatComponentStateTest //---- testStateButton18 ---- testStateButton18.setEnabled(false); - testStateButton18.putClientProperty("JComponent.minimumWidth", 0); - testStateButton18.putClientProperty("JButton.buttonType", "help"); + testStateButton18.putClientProperty(FlatClientProperties.MINIMUM_WIDTH, 0); + testStateButton18.putClientProperty(FlatClientProperties.BUTTON_TYPE, FlatClientProperties.BUTTON_TYPE_HELP); add(testStateButton18, "cell 9 5"); //---- label10 ---- @@ -488,12 +488,12 @@ public class FlatComponentStateTest //---- button1 ---- button1.setText("text"); - button1.putClientProperty("JComponent.minimumWidth", 0); + button1.putClientProperty(FlatClientProperties.MINIMUM_WIDTH, 0); add(button1, "cell 1 6"); //---- testDefaultButton1 ---- testDefaultButton1.setText("text"); - testDefaultButton1.putClientProperty("JComponent.minimumWidth", 0); + testDefaultButton1.putClientProperty(FlatClientProperties.MINIMUM_WIDTH, 0); add(testDefaultButton1, "cell 2 6"); //---- toggleButton1 ---- @@ -506,19 +506,19 @@ public class FlatComponentStateTest add(toggleButton2, "cell 6 6"); //---- button2 ---- - button2.putClientProperty("JComponent.minimumWidth", 0); - button2.putClientProperty("JButton.buttonType", "help"); + button2.putClientProperty(FlatClientProperties.MINIMUM_WIDTH, 0); + button2.putClientProperty(FlatClientProperties.BUTTON_TYPE, FlatClientProperties.BUTTON_TYPE_HELP); add(button2, "cell 9 6"); add(separator1, "cell 0 7 11 1"); //---- label22 ---- label22.setText("JCheckBox"); - label22.putClientProperty("FlatLaf.styleClass", "h3"); + label22.putClientProperty(FlatClientProperties.STYLE_CLASS, "h3"); add(label22, "cell 1 8 2 1"); //---- label27 ---- label27.setText("JRadioButton"); - label27.putClientProperty("FlatLaf.styleClass", "h3"); + label27.putClientProperty(FlatClientProperties.STYLE_CLASS, "h3"); add(label27, "cell 5 8 2 1"); //---- label23 ---- diff --git a/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatCustomBordersTest.java b/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatCustomBordersTest.java index 2d2bd064..26a4a56b 100644 --- a/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatCustomBordersTest.java +++ b/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatCustomBordersTest.java @@ -21,6 +21,7 @@ import javax.swing.*; import javax.swing.border.*; import javax.swing.plaf.basic.BasicComboBoxEditor; import javax.swing.plaf.basic.BasicComboBoxRenderer; +import com.formdev.flatlaf.FlatClientProperties; import com.formdev.flatlaf.icons.FlatFileViewFloppyDriveIcon; import com.formdev.flatlaf.util.UIScale; import net.miginfocom.swing.*; @@ -342,22 +343,22 @@ public class FlatCustomBordersTest //---- button5 ---- button5.setText("text"); - button5.putClientProperty("JButton.buttonType", "roundRect"); + button5.putClientProperty(FlatClientProperties.BUTTON_TYPE, FlatClientProperties.BUTTON_TYPE_ROUND_RECT); add(button5, "cell 1 2"); //---- button6 ---- button6.setText("text"); - button6.putClientProperty("JButton.buttonType", "roundRect"); + button6.putClientProperty(FlatClientProperties.BUTTON_TYPE, FlatClientProperties.BUTTON_TYPE_ROUND_RECT); add(button6, "cell 2 2"); //---- button7 ---- button7.setText("text"); - button7.putClientProperty("JButton.buttonType", "roundRect"); + button7.putClientProperty(FlatClientProperties.BUTTON_TYPE, FlatClientProperties.BUTTON_TYPE_ROUND_RECT); add(button7, "cell 3 2"); //---- button8 ---- button8.setText("text"); - button8.putClientProperty("JButton.buttonType", "roundRect"); + button8.putClientProperty(FlatClientProperties.BUTTON_TYPE, FlatClientProperties.BUTTON_TYPE_ROUND_RECT); add(button8, "cell 4 2"); //---- label5 ---- @@ -372,31 +373,31 @@ public class FlatCustomBordersTest add(comboBox27, "cell 7 3"); //---- comboBox5 ---- - comboBox5.putClientProperty("JComponent.roundRect", true); + comboBox5.putClientProperty(FlatClientProperties.COMPONENT_ROUND_RECT, true); add(comboBox5, "cell 1 4"); //---- comboBox6 ---- - comboBox6.putClientProperty("JComponent.roundRect", true); + comboBox6.putClientProperty(FlatClientProperties.COMPONENT_ROUND_RECT, true); add(comboBox6, "cell 2 4"); //---- comboBox7 ---- - comboBox7.putClientProperty("JComponent.roundRect", true); + comboBox7.putClientProperty(FlatClientProperties.COMPONENT_ROUND_RECT, true); add(comboBox7, "cell 3 4"); //---- comboBox8 ---- - comboBox8.putClientProperty("JComponent.roundRect", true); + comboBox8.putClientProperty(FlatClientProperties.COMPONENT_ROUND_RECT, true); add(comboBox8, "cell 4 4"); //---- comboBox24 ---- - comboBox24.putClientProperty("JComponent.roundRect", true); + comboBox24.putClientProperty(FlatClientProperties.COMPONENT_ROUND_RECT, true); add(comboBox24, "cell 5 4"); //---- comboBox26 ---- - comboBox26.putClientProperty("JComponent.roundRect", true); + comboBox26.putClientProperty(FlatClientProperties.COMPONENT_ROUND_RECT, true); add(comboBox26, "cell 6 4"); //---- comboBox28 ---- - comboBox28.putClientProperty("JComponent.roundRect", true); + comboBox28.putClientProperty(FlatClientProperties.COMPONENT_ROUND_RECT, true); add(comboBox28, "cell 7 4"); //---- comboBox9 ---- @@ -428,37 +429,37 @@ public class FlatCustomBordersTest add(comboBox21, "cell 7 5"); //---- comboBox13 ---- - comboBox13.putClientProperty("JComponent.roundRect", true); + comboBox13.putClientProperty(FlatClientProperties.COMPONENT_ROUND_RECT, true); comboBox13.setEditable(true); add(comboBox13, "cell 1 6"); //---- comboBox14 ---- - comboBox14.putClientProperty("JComponent.roundRect", true); + comboBox14.putClientProperty(FlatClientProperties.COMPONENT_ROUND_RECT, true); comboBox14.setEditable(true); add(comboBox14, "cell 2 6"); //---- comboBox15 ---- - comboBox15.putClientProperty("JComponent.roundRect", true); + comboBox15.putClientProperty(FlatClientProperties.COMPONENT_ROUND_RECT, true); comboBox15.setEditable(true); add(comboBox15, "cell 3 6"); //---- comboBox16 ---- - comboBox16.putClientProperty("JComponent.roundRect", true); + comboBox16.putClientProperty(FlatClientProperties.COMPONENT_ROUND_RECT, true); comboBox16.setEditable(true); add(comboBox16, "cell 4 6"); //---- comboBox18 ---- - comboBox18.putClientProperty("JComponent.roundRect", true); + comboBox18.putClientProperty(FlatClientProperties.COMPONENT_ROUND_RECT, true); comboBox18.setEditable(true); add(comboBox18, "cell 5 6"); //---- comboBox20 ---- - comboBox20.putClientProperty("JComponent.roundRect", true); + comboBox20.putClientProperty(FlatClientProperties.COMPONENT_ROUND_RECT, true); comboBox20.setEditable(true); add(comboBox20, "cell 6 6"); //---- comboBox22 ---- - comboBox22.putClientProperty("JComponent.roundRect", true); + comboBox22.putClientProperty(FlatClientProperties.COMPONENT_ROUND_RECT, true); comboBox22.setEditable(true); add(comboBox22, "cell 7 6"); @@ -471,19 +472,19 @@ public class FlatCustomBordersTest add(spinner4, "cell 4 7"); //---- spinner5 ---- - spinner5.putClientProperty("JComponent.roundRect", true); + spinner5.putClientProperty(FlatClientProperties.COMPONENT_ROUND_RECT, true); add(spinner5, "cell 1 8"); //---- spinner6 ---- - spinner6.putClientProperty("JComponent.roundRect", true); + spinner6.putClientProperty(FlatClientProperties.COMPONENT_ROUND_RECT, true); add(spinner6, "cell 2 8"); //---- spinner7 ---- - spinner7.putClientProperty("JComponent.roundRect", true); + spinner7.putClientProperty(FlatClientProperties.COMPONENT_ROUND_RECT, true); add(spinner7, "cell 3 8"); //---- spinner8 ---- - spinner8.putClientProperty("JComponent.roundRect", true); + spinner8.putClientProperty(FlatClientProperties.COMPONENT_ROUND_RECT, true); add(spinner8, "cell 4 8"); //---- textFieldLabel ---- @@ -492,11 +493,11 @@ public class FlatCustomBordersTest //---- textField1 ---- textField1.setText("text"); - textField1.putClientProperty("JComponent.roundRect", false); + textField1.putClientProperty(FlatClientProperties.COMPONENT_ROUND_RECT, false); add(textField1, "cell 1 9,growx"); //---- textField2 ---- - textField2.putClientProperty("JComponent.roundRect", false); + textField2.putClientProperty(FlatClientProperties.COMPONENT_ROUND_RECT, false); textField2.setText("text"); add(textField2, "cell 2 9"); @@ -505,27 +506,27 @@ public class FlatCustomBordersTest add(textField3, "cell 3 9"); //---- textField4 ---- - textField4.putClientProperty("JComponent.roundRect", false); + textField4.putClientProperty(FlatClientProperties.COMPONENT_ROUND_RECT, false); textField4.setText("text"); add(textField4, "cell 4 9"); //---- textField5 ---- textField5.setText("text"); - textField5.putClientProperty("JComponent.roundRect", true); + textField5.putClientProperty(FlatClientProperties.COMPONENT_ROUND_RECT, true); add(textField5, "cell 1 10,growx"); //---- textField6 ---- - textField6.putClientProperty("JComponent.roundRect", true); + textField6.putClientProperty(FlatClientProperties.COMPONENT_ROUND_RECT, true); textField6.setText("text"); add(textField6, "cell 2 10"); //---- textField7 ---- textField7.setText("text"); - textField7.putClientProperty("JComponent.roundRect", true); + textField7.putClientProperty(FlatClientProperties.COMPONENT_ROUND_RECT, true); add(textField7, "cell 3 10"); //---- textField8 ---- - textField8.putClientProperty("JComponent.roundRect", true); + textField8.putClientProperty(FlatClientProperties.COMPONENT_ROUND_RECT, true); textField8.setText("text"); add(textField8, "cell 4 10"); diff --git a/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatFontsTest.java b/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatFontsTest.java index acfe6321..2040ec0f 100644 --- a/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatFontsTest.java +++ b/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatFontsTest.java @@ -22,6 +22,7 @@ import java.awt.Font; import java.util.Map; import java.util.TreeMap; import javax.swing.*; +import com.formdev.flatlaf.FlatClientProperties; import com.formdev.flatlaf.fonts.inter.FlatInterFont; import com.formdev.flatlaf.fonts.jetbrains_mono.FlatJetBrainsMonoFont; import com.formdev.flatlaf.fonts.roboto.FlatRobotoFont; @@ -132,7 +133,7 @@ public class FlatFontsTest //---- previewFamilyNameLabel ---- previewFamilyNameLabel.setText("name"); - previewFamilyNameLabel.putClientProperty("FlatLaf.styleClass", "h1"); + previewFamilyNameLabel.putClientProperty(FlatClientProperties.STYLE_CLASS, "h1"); add(previewFamilyNameLabel, "cell 1 1"); //======== familiesScrollPane ======== diff --git a/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatTestFrame.java b/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatTestFrame.java index e7f1bc5c..520220a9 100644 --- a/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatTestFrame.java +++ b/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatTestFrame.java @@ -37,6 +37,7 @@ import javax.swing.UIManager.LookAndFeelInfo; import javax.swing.plaf.ColorUIResource; import javax.swing.plaf.metal.MetalLookAndFeel; import javax.swing.plaf.nimbus.NimbusLookAndFeel; +import com.formdev.flatlaf.FlatClientProperties; import com.formdev.flatlaf.FlatDarculaLaf; import com.formdev.flatlaf.FlatDarkLaf; import com.formdev.flatlaf.FlatIntelliJLaf; @@ -806,7 +807,7 @@ public class FlatTestFrame buttonBar.add(scaleFactorComboBox, "cell 1 0"); //---- fontSizeSpinner ---- - fontSizeSpinner.putClientProperty("JComponent.minimumWidth", 50); + fontSizeSpinner.putClientProperty(FlatClientProperties.MINIMUM_WIDTH, 50); fontSizeSpinner.setModel(new SpinnerNumberModel(0, 0, null, 1)); fontSizeSpinner.addChangeListener(e -> fontSizeChanged()); buttonBar.add(fontSizeSpinner, "cell 2 0"); diff --git a/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatTextComponentsTest.java b/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatTextComponentsTest.java index 6a2e8729..8b74098e 100644 --- a/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatTextComponentsTest.java +++ b/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatTextComponentsTest.java @@ -316,13 +316,13 @@ public class FlatTextComponentsTest //---- textField1 ---- textField1.setText("editable"); textField1.setComponentPopupMenu(popupMenu1); - textField1.putClientProperty("JTextField.placeholderText", "place"); + textField1.putClientProperty(FlatClientProperties.PLACEHOLDER_TEXT, "place"); add(textField1, "cell 1 0,growx"); //---- textField3 ---- textField3.setText("longer text for testing horizontal scrolling"); textField3.setComponentPopupMenu(popupMenu1); - textField3.putClientProperty("JTextField.placeholderText", "place"); + textField3.putClientProperty(FlatClientProperties.PLACEHOLDER_TEXT, "place"); add(textField3, "cell 2 0,growx"); //---- textField2 ---- @@ -330,7 +330,7 @@ public class FlatTextComponentsTest textField2.setSelectionStart(1); textField2.setSelectionEnd(4); textField2.setComponentPopupMenu(popupMenu1); - textField2.putClientProperty("JTextField.placeholderText", "place"); + textField2.putClientProperty(FlatClientProperties.PLACEHOLDER_TEXT, "place"); add(textField2, "cell 3 0"); //---- formattedTextFieldLabel ---- @@ -342,13 +342,13 @@ public class FlatTextComponentsTest //---- formattedTextField1 ---- formattedTextField1.setText("editable"); formattedTextField1.setComponentPopupMenu(popupMenu1); - formattedTextField1.putClientProperty("JTextField.placeholderText", "place"); + formattedTextField1.putClientProperty(FlatClientProperties.PLACEHOLDER_TEXT, "place"); add(formattedTextField1, "cell 1 1,growx"); //---- formattedTextField3 ---- formattedTextField3.setText("longer text for testing horizontal scrolling"); formattedTextField3.setComponentPopupMenu(popupMenu1); - formattedTextField3.putClientProperty("JTextField.placeholderText", "place"); + formattedTextField3.putClientProperty(FlatClientProperties.PLACEHOLDER_TEXT, "place"); add(formattedTextField3, "cell 2 1,growx"); //======== panel1 ======== @@ -539,13 +539,13 @@ public class FlatTextComponentsTest //---- passwordField1 ---- passwordField1.setText("editable"); passwordField1.setComponentPopupMenu(popupMenu1); - passwordField1.putClientProperty("JTextField.placeholderText", "place"); + passwordField1.putClientProperty(FlatClientProperties.PLACEHOLDER_TEXT, "place"); add(passwordField1, "cell 1 2,growx"); //---- passwordField3 ---- passwordField3.setText("longer text for testing horizontal scrolling"); passwordField3.setComponentPopupMenu(popupMenu1); - passwordField3.putClientProperty("JTextField.placeholderText", "place"); + passwordField3.putClientProperty(FlatClientProperties.PLACEHOLDER_TEXT, "place"); add(passwordField3, "cell 2 2,growx"); //---- textAreaLabel ---- diff --git a/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatTypographyTest.java b/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatTypographyTest.java index a528cf06..d19bf917 100644 --- a/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatTypographyTest.java +++ b/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatTypographyTest.java @@ -24,6 +24,7 @@ import java.io.IOException; import java.net.URI; import java.net.URISyntaxException; import javax.swing.*; +import com.formdev.flatlaf.FlatClientProperties; import net.miginfocom.swing.*; /** @@ -205,57 +206,57 @@ public class FlatTypographyTest //---- label54 ---- label54.setText("FlatLaf
Windows"); - label54.putClientProperty("FlatLaf.styleClass", "h1"); + label54.putClientProperty(FlatClientProperties.STYLE_CLASS, "h1"); add(label54, "cell 0 0"); //---- label68 ---- label68.setText("JetBrains
Windows"); - label68.putClientProperty("FlatLaf.styleClass", "h1"); + label68.putClientProperty(FlatClientProperties.STYLE_CLASS, "h1"); add(label68, "cell 1 0"); //---- label69 ---- label69.setText("JetBrains
macOS"); - label69.putClientProperty("FlatLaf.styleClass", "h1"); + label69.putClientProperty(FlatClientProperties.STYLE_CLASS, "h1"); add(label69, "cell 2 0"); //---- label10 ---- label10.setText("macOS"); - label10.putClientProperty("FlatLaf.styleClass", "h1"); + label10.putClientProperty(FlatClientProperties.STYLE_CLASS, "h1"); add(label10, "cell 3 0"); //---- label11 ---- label11.setText("Windows 10/11"); - label11.putClientProperty("FlatLaf.styleClass", "h1"); + label11.putClientProperty(FlatClientProperties.STYLE_CLASS, "h1"); add(label11, "cell 4 0"); //---- label72 ---- label72.setText("GitHub
Primer"); - label72.putClientProperty("FlatLaf.styleClass", "h1"); + label72.putClientProperty(FlatClientProperties.STYLE_CLASS, "h1"); add(label72, "cell 5 0"); //---- label28 ---- label28.setText("Material"); - label28.putClientProperty("FlatLaf.styleClass", "h1"); + label28.putClientProperty(FlatClientProperties.STYLE_CLASS, "h1"); add(label28, "cell 6 0"); //---- label29 ---- label29.setText("Material 3"); - label29.putClientProperty("FlatLaf.styleClass", "h1"); + label29.putClientProperty(FlatClientProperties.STYLE_CLASS, "h1"); add(label29, "cell 7 0"); //---- label1 ---- label1.setText("SAP Fiori"); - label1.putClientProperty("FlatLaf.styleClass", "h1"); + label1.putClientProperty(FlatClientProperties.STYLE_CLASS, "h1"); add(label1, "cell 8 0"); //---- label37 ---- label37.setText("Atlassian"); - label37.putClientProperty("FlatLaf.styleClass", "h1"); + label37.putClientProperty(FlatClientProperties.STYLE_CLASS, "h1"); add(label37, "cell 9 0"); //---- label46 ---- label46.setText("Iris"); - label46.putClientProperty("FlatLaf.styleClass", "h1"); + label46.putClientProperty(FlatClientProperties.STYLE_CLASS, "h1"); add(label46, "cell 10 0"); //---- linkLabel9 ---- @@ -1147,7 +1148,7 @@ public class FlatTypographyTest //---- descLabel ---- descLabel.setText("description"); - descLabel.putClientProperty("FlatLaf.styleClass", "small"); + descLabel.putClientProperty(FlatClientProperties.STYLE_CLASS, "small"); descLabel.setEnabled(false); add(descLabel, "cell 0 1"); // JFormDesigner - End of component initialization //GEN-END:initComponents diff --git a/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatWindowDecorationsTest.java b/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatWindowDecorationsTest.java index 2f962068..ed8fa934 100644 --- a/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatWindowDecorationsTest.java +++ b/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatWindowDecorationsTest.java @@ -241,7 +241,7 @@ public class FlatWindowDecorationsTest tallCompCheckBox.setSelected( false ); JButton myButton = new JButton( "?" ); - myButton.putClientProperty( "JButton.buttonType", "toolBarButton" ); + myButton.putClientProperty( FlatClientProperties.BUTTON_TYPE, FlatClientProperties.BUTTON_TYPE_TOOLBAR_BUTTON ); myButton.setFocusable( false ); menuBar.add( Box.createGlue() ); @@ -499,7 +499,7 @@ debug*/ if( typeUtilityRadioButton.isSelected() ) window.setType( Window.Type.UTILITY ); else if( typeSmallRadioButton.isSelected() ) - ((RootPaneContainer)window).getRootPane().putClientProperty( "Window.style", "small" ); + ((RootPaneContainer)window).getRootPane().putClientProperty( FlatClientProperties.WINDOW_STYLE, FlatClientProperties.WINDOW_STYLE_SMALL ); } private void decorationStyleChanged() { diff --git a/flatlaf-theme-editor/src/main/java/com/formdev/flatlaf/themeeditor/FlatThemePreview.java b/flatlaf-theme-editor/src/main/java/com/formdev/flatlaf/themeeditor/FlatThemePreview.java index ca004201..3bcdfef3 100644 --- a/flatlaf-theme-editor/src/main/java/com/formdev/flatlaf/themeeditor/FlatThemePreview.java +++ b/flatlaf-theme-editor/src/main/java/com/formdev/flatlaf/themeeditor/FlatThemePreview.java @@ -28,6 +28,7 @@ import javax.swing.UIDefaults.ActiveValue; import javax.swing.UIDefaults.LazyValue; import javax.swing.event.DocumentEvent; import javax.swing.event.DocumentListener; +import com.formdev.flatlaf.FlatClientProperties; import com.formdev.flatlaf.FlatLaf; import com.formdev.flatlaf.UIDefaultsLoaderAccessor; import com.formdev.flatlaf.extras.components.*; @@ -252,7 +253,7 @@ class FlatThemePreview //---- previewLabel ---- previewLabel.setText(" Preview "); - previewLabel.putClientProperty("FlatLaf.styleClass", "h2"); + previewLabel.putClientProperty(FlatClientProperties.STYLE_CLASS, "h2"); // JFormDesigner - End of component initialization //GEN-END:initComponents } diff --git a/flatlaf-theme-editor/src/main/java/com/formdev/flatlaf/themeeditor/FlatThemePreviewAll.java b/flatlaf-theme-editor/src/main/java/com/formdev/flatlaf/themeeditor/FlatThemePreviewAll.java index 6fcf2711..ced8ac8e 100644 --- a/flatlaf-theme-editor/src/main/java/com/formdev/flatlaf/themeeditor/FlatThemePreviewAll.java +++ b/flatlaf-theme-editor/src/main/java/com/formdev/flatlaf/themeeditor/FlatThemePreviewAll.java @@ -423,7 +423,7 @@ class FlatThemePreviewAll //---- label1 ---- label1.setText("Some Text"); - label1.putClientProperty("FlatLaf.styleClass", "flatlaf-preview-label"); + label1.putClientProperty(FlatClientProperties.STYLE_CLASS, "flatlaf-preview-label"); add(label1, "cell 1 1 2 1"); //---- flatButton1 ---- @@ -438,12 +438,12 @@ class FlatThemePreviewAll //---- button1 ---- button1.setText("OK"); - button1.putClientProperty("FlatLaf.styleClass", "flatlaf-preview-button"); + button1.putClientProperty(FlatClientProperties.STYLE_CLASS, "flatlaf-preview-button"); add(button1, "cell 1 2"); //---- testDefaultButton1 ---- testDefaultButton1.setText("Default"); - testDefaultButton1.putClientProperty("FlatLaf.styleClass", "flatlaf-preview-button"); + testDefaultButton1.putClientProperty(FlatClientProperties.STYLE_CLASS, "flatlaf-preview-button"); add(testDefaultButton1, "cell 2 2"); //---- toggleButtonLabel ---- @@ -452,13 +452,13 @@ class FlatThemePreviewAll //---- toggleButton1 ---- toggleButton1.setText("Unselected"); - toggleButton1.putClientProperty("FlatLaf.styleClass", "flatlaf-preview-togglebutton"); + toggleButton1.putClientProperty(FlatClientProperties.STYLE_CLASS, "flatlaf-preview-togglebutton"); add(toggleButton1, "cell 1 3"); //---- toggleButton3 ---- toggleButton3.setText("Selected"); toggleButton3.setSelected(true); - toggleButton3.putClientProperty("FlatLaf.styleClass", "flatlaf-preview-togglebutton"); + toggleButton3.putClientProperty(FlatClientProperties.STYLE_CLASS, "flatlaf-preview-togglebutton"); add(toggleButton3, "cell 2 3"); //---- checkBoxLabel ---- @@ -467,13 +467,13 @@ class FlatThemePreviewAll //---- checkBox1 ---- checkBox1.setText("Unselected"); - checkBox1.putClientProperty("FlatLaf.styleClass", "flatlaf-preview-checkbox"); + checkBox1.putClientProperty(FlatClientProperties.STYLE_CLASS, "flatlaf-preview-checkbox"); add(checkBox1, "cell 1 4,alignx left,growx 0"); //---- checkBox3 ---- checkBox3.setText("Selected"); checkBox3.setSelected(true); - checkBox3.putClientProperty("FlatLaf.styleClass", "flatlaf-preview-checkbox"); + checkBox3.putClientProperty(FlatClientProperties.STYLE_CLASS, "flatlaf-preview-checkbox"); add(checkBox3, "cell 2 4,alignx left,growx 0"); //---- radioButtonLabel ---- @@ -482,13 +482,13 @@ class FlatThemePreviewAll //---- radioButton1 ---- radioButton1.setText("Unselected"); - radioButton1.putClientProperty("FlatLaf.styleClass", "flatlaf-preview-radiobutton"); + radioButton1.putClientProperty(FlatClientProperties.STYLE_CLASS, "flatlaf-preview-radiobutton"); add(radioButton1, "cell 1 5,alignx left,growx 0"); //---- radioButton3 ---- radioButton3.setText("Selected"); radioButton3.setSelected(true); - radioButton3.putClientProperty("FlatLaf.styleClass", "flatlaf-preview-radiobutton"); + radioButton3.putClientProperty(FlatClientProperties.STYLE_CLASS, "flatlaf-preview-radiobutton"); add(radioButton3, "cell 2 5,alignx left,growx 0"); //---- comboBoxLabel ---- @@ -513,7 +513,7 @@ class FlatThemePreviewAll })); comboBox1.setMaximumRowCount(6); comboBox1.setPlaceholderText("placeholder text"); - comboBox1.putClientProperty("FlatLaf.styleClass", "flatlaf-preview-combobox"); + comboBox1.putClientProperty(FlatClientProperties.STYLE_CLASS, "flatlaf-preview-combobox"); add(comboBox1, "cell 1 6"); //---- comboBox3 ---- @@ -526,7 +526,7 @@ class FlatThemePreviewAll "e" })); comboBox3.setMaximumRowCount(6); - comboBox3.putClientProperty("FlatLaf.styleClass", "flatlaf-preview-combobox"); + comboBox3.putClientProperty(FlatClientProperties.STYLE_CLASS, "flatlaf-preview-combobox"); add(comboBox3, "cell 2 6"); //---- spinnerLabel ---- @@ -534,7 +534,7 @@ class FlatThemePreviewAll add(spinnerLabel, "cell 0 7"); //---- spinner1 ---- - spinner1.putClientProperty("FlatLaf.styleClass", "flatlaf-preview-spinner"); + spinner1.putClientProperty(FlatClientProperties.STYLE_CLASS, "flatlaf-preview-spinner"); add(spinner1, "cell 1 7 2 1"); //---- textFieldLabel ---- @@ -544,24 +544,24 @@ class FlatThemePreviewAll //---- textField1 ---- textField1.setText("Some Text"); textField1.setPlaceholderText("placeholder text"); - textField1.putClientProperty("FlatLaf.styleClass", "flatlaf-preview-textfield"); + textField1.putClientProperty(FlatClientProperties.STYLE_CLASS, "flatlaf-preview-textfield"); add(textField1, "cell 1 8"); //---- textField2 ---- textField2.setText("Txt"); - textField2.putClientProperty("FlatLaf.styleClass", "flatlaf-preview-textfield"); + textField2.putClientProperty(FlatClientProperties.STYLE_CLASS, "flatlaf-preview-textfield"); add(textField2, "cell 2 8"); //---- formattedTextField1 ---- formattedTextField1.setText("Some Text"); formattedTextField1.setPlaceholderText("placeholder text"); - formattedTextField1.putClientProperty("FlatLaf.styleClass", "flatlaf-preview-formattedtextfield"); + formattedTextField1.putClientProperty(FlatClientProperties.STYLE_CLASS, "flatlaf-preview-formattedtextfield"); add(formattedTextField1, "cell 1 9"); //---- passwordField1 ---- passwordField1.setText("Some Text"); passwordField1.setPlaceholderText("placeholder text"); - passwordField1.putClientProperty("FlatLaf.styleClass", "flatlaf-preview-passwordfield"); + passwordField1.putClientProperty(FlatClientProperties.STYLE_CLASS, "flatlaf-preview-passwordfield"); passwordField1.setShowClearButton(true); add(passwordField1, "cell 2 9"); @@ -577,7 +577,7 @@ class FlatThemePreviewAll //---- textArea1 ---- textArea1.setText("Text"); textArea1.setRows(2); - textArea1.putClientProperty("FlatLaf.styleClass", "flatlaf-preview-textarea"); + textArea1.putClientProperty(FlatClientProperties.STYLE_CLASS, "flatlaf-preview-textarea"); scrollPane1.setViewportView(textArea1); } add(scrollPane1, "cell 1 10 2 1,width 40"); @@ -589,7 +589,7 @@ class FlatThemePreviewAll //---- editorPane1 ---- editorPane1.setText("Text"); - editorPane1.putClientProperty("FlatLaf.styleClass", "flatlaf-preview-editorpane"); + editorPane1.putClientProperty(FlatClientProperties.STYLE_CLASS, "flatlaf-preview-editorpane"); scrollPane5.setViewportView(editorPane1); } add(scrollPane5, "cell 1 10 2 1,width 40"); @@ -601,7 +601,7 @@ class FlatThemePreviewAll //---- textPane1 ---- textPane1.setText("Text"); - textPane1.putClientProperty("FlatLaf.styleClass", "flatlaf-preview-textpane"); + textPane1.putClientProperty(FlatClientProperties.STYLE_CLASS, "flatlaf-preview-textpane"); scrollPane9.setViewportView(textPane1); } add(scrollPane9, "cell 1 10 2 1,width 40"); @@ -615,62 +615,62 @@ class FlatThemePreviewAll menuUnderlineSelectionButton.setButtonType(FlatButton.ButtonType.toolBarButton); menuUnderlineSelectionButton.setToolTipText("menu underline selection"); menuUnderlineSelectionButton.setFocusable(false); - menuUnderlineSelectionButton.putClientProperty("FlatLaf.styleClass", "small"); + menuUnderlineSelectionButton.putClientProperty(FlatClientProperties.STYLE_CLASS, "small"); menuUnderlineSelectionButton.addActionListener(e -> menuUnderlineSelectionChanged()); add(menuUnderlineSelectionButton, "cell 0 11"); //======== menuBar1 ======== { - menuBar1.putClientProperty("FlatLaf.styleClass", "flatlaf-preview-menubar"); + menuBar1.putClientProperty(FlatClientProperties.STYLE_CLASS, "flatlaf-preview-menubar"); //======== menu2 ======== { menu2.setText("JMenu"); - menu2.putClientProperty("FlatLaf.styleClass", "flatlaf-preview-menu"); + menu2.putClientProperty(FlatClientProperties.STYLE_CLASS, "flatlaf-preview-menu"); //---- menuItem3 ---- menuItem3.setText("JMenuItem"); - menuItem3.putClientProperty("FlatLaf.styleClass", "flatlaf-preview-menuitem"); + menuItem3.putClientProperty(FlatClientProperties.STYLE_CLASS, "flatlaf-preview-menuitem"); menu2.add(menuItem3); //---- menuItem4 ---- menuItem4.setText("JMenuItem"); - menuItem4.putClientProperty("FlatLaf.styleClass", "flatlaf-preview-menuitem"); + menuItem4.putClientProperty(FlatClientProperties.STYLE_CLASS, "flatlaf-preview-menuitem"); menu2.add(menuItem4); menu2.addSeparator(); //---- checkBoxMenuItem2 ---- checkBoxMenuItem2.setText("JCheckBoxMenuItem"); checkBoxMenuItem2.setSelected(true); - checkBoxMenuItem2.putClientProperty("FlatLaf.styleClass", "flatlaf-preview-checkboxmenuitem"); + checkBoxMenuItem2.putClientProperty(FlatClientProperties.STYLE_CLASS, "flatlaf-preview-checkboxmenuitem"); menu2.add(checkBoxMenuItem2); //---- checkBoxMenuItem3 ---- checkBoxMenuItem3.setText("JCheckBoxMenuItem"); - checkBoxMenuItem3.putClientProperty("FlatLaf.styleClass", "flatlaf-preview-checkboxmenuitem"); + checkBoxMenuItem3.putClientProperty(FlatClientProperties.STYLE_CLASS, "flatlaf-preview-checkboxmenuitem"); menu2.add(checkBoxMenuItem3); menu2.addSeparator(); //---- radioButtonMenuItem4 ---- radioButtonMenuItem4.setText("JRadioButtonMenuItem"); radioButtonMenuItem4.setSelected(true); - radioButtonMenuItem4.putClientProperty("FlatLaf.styleClass", "flatlaf-preview-radiobuttonmenuitem"); + radioButtonMenuItem4.putClientProperty(FlatClientProperties.STYLE_CLASS, "flatlaf-preview-radiobuttonmenuitem"); menu2.add(radioButtonMenuItem4); //---- radioButtonMenuItem5 ---- radioButtonMenuItem5.setText("JRadioButtonMenuItem"); - radioButtonMenuItem5.putClientProperty("FlatLaf.styleClass", "flatlaf-preview-radiobuttonmenuitem"); + radioButtonMenuItem5.putClientProperty(FlatClientProperties.STYLE_CLASS, "flatlaf-preview-radiobuttonmenuitem"); menu2.add(radioButtonMenuItem5); menu2.addSeparator(); //======== menu4 ======== { menu4.setText("JMenu"); - menu4.putClientProperty("FlatLaf.styleClass", "flatlaf-preview-menu"); + menu4.putClientProperty(FlatClientProperties.STYLE_CLASS, "flatlaf-preview-menu"); //---- menuItem6 ---- menuItem6.setText("JMenuItem"); - menuItem6.putClientProperty("FlatLaf.styleClass", "flatlaf-preview-menuitem"); + menuItem6.putClientProperty(FlatClientProperties.STYLE_CLASS, "flatlaf-preview-menuitem"); menu4.add(menuItem6); } menu2.add(menu4); @@ -678,11 +678,11 @@ class FlatThemePreviewAll //======== menu5 ======== { menu5.setText("JMenu"); - menu5.putClientProperty("FlatLaf.styleClass", "flatlaf-preview-menu"); + menu5.putClientProperty(FlatClientProperties.STYLE_CLASS, "flatlaf-preview-menu"); //---- menuItem7 ---- menuItem7.setText("JMenuItem"); - menuItem7.putClientProperty("FlatLaf.styleClass", "flatlaf-preview-menuitem"); + menuItem7.putClientProperty(FlatClientProperties.STYLE_CLASS, "flatlaf-preview-menuitem"); menu5.add(menuItem7); } menu2.add(menu5); @@ -692,22 +692,22 @@ class FlatThemePreviewAll //======== menu3 ======== { menu3.setText("JMenu"); - menu3.putClientProperty("FlatLaf.styleClass", "flatlaf-preview-menu"); + menu3.putClientProperty(FlatClientProperties.STYLE_CLASS, "flatlaf-preview-menu"); //---- menuItem5 ---- menuItem5.setText("JMenuItem"); menuItem5.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_P, KeyEvent.CTRL_DOWN_MASK|KeyEvent.ALT_DOWN_MASK|KeyEvent.SHIFT_DOWN_MASK)); - menuItem5.putClientProperty("FlatLaf.styleClass", "flatlaf-preview-menuitem"); + menuItem5.putClientProperty(FlatClientProperties.STYLE_CLASS, "flatlaf-preview-menuitem"); menu3.add(menuItem5); //---- menuItem8 ---- menuItem8.setText("JMenuItem"); - menuItem8.putClientProperty("FlatLaf.styleClass", "flatlaf-preview-menuitem"); + menuItem8.putClientProperty(FlatClientProperties.STYLE_CLASS, "flatlaf-preview-menuitem"); menu3.add(menuItem8); //---- menuItem9 ---- menuItem9.setText("JMenuItem"); - menuItem9.putClientProperty("FlatLaf.styleClass", "flatlaf-preview-menuitem"); + menuItem9.putClientProperty(FlatClientProperties.STYLE_CLASS, "flatlaf-preview-menuitem"); menu3.add(menuItem9); } menuBar1.add(menu3); @@ -720,14 +720,14 @@ class FlatThemePreviewAll //---- scrollBar1 ---- scrollBar1.setOrientation(Adjustable.HORIZONTAL); - scrollBar1.putClientProperty("FlatLaf.styleClass", "flatlaf-preview-scrollbar"); + scrollBar1.putClientProperty(FlatClientProperties.STYLE_CLASS, "flatlaf-preview-scrollbar"); scrollBar1.setVisibleAmount(50); add(scrollBar1, "cell 1 12 2 1"); //---- scrollBar5 ---- scrollBar5.setOrientation(Adjustable.HORIZONTAL); scrollBar5.setShowButtons(true); - scrollBar5.putClientProperty("FlatLaf.styleClass", "flatlaf-preview-scrollbar"); + scrollBar5.putClientProperty(FlatClientProperties.STYLE_CLASS, "flatlaf-preview-scrollbar"); scrollBar5.setVisibleAmount(50); add(scrollBar5, "cell 1 13 2 1"); @@ -736,7 +736,7 @@ class FlatThemePreviewAll add(separatorLabel, "cell 0 14"); //---- separator1 ---- - separator1.putClientProperty("FlatLaf.styleClass", "flatlaf-preview-separator"); + separator1.putClientProperty(FlatClientProperties.STYLE_CLASS, "flatlaf-preview-separator"); add(separator1, "cell 1 14 2 1"); //---- sliderLabel ---- @@ -744,7 +744,7 @@ class FlatThemePreviewAll add(sliderLabel, "cell 0 15"); //---- slider1 ---- - slider1.putClientProperty("FlatLaf.styleClass", "flatlaf-preview-slider"); + slider1.putClientProperty(FlatClientProperties.STYLE_CLASS, "flatlaf-preview-slider"); add(slider1, "cell 1 15 2 1,width 100"); //---- slider3 ---- @@ -752,7 +752,7 @@ class FlatThemePreviewAll slider3.setPaintTicks(true); slider3.setMajorTickSpacing(50); slider3.setPaintLabels(true); - slider3.putClientProperty("FlatLaf.styleClass", "flatlaf-preview-slider"); + slider3.putClientProperty(FlatClientProperties.STYLE_CLASS, "flatlaf-preview-slider"); slider3.addChangeListener(e -> changeProgress()); add(slider3, "cell 1 16 2 1,width 100"); @@ -762,13 +762,13 @@ class FlatThemePreviewAll //---- progressBar1 ---- progressBar1.setValue(50); - progressBar1.putClientProperty("FlatLaf.styleClass", "flatlaf-preview-progressbar"); + progressBar1.putClientProperty(FlatClientProperties.STYLE_CLASS, "flatlaf-preview-progressbar"); add(progressBar1, "cell 1 17 2 1"); //---- progressBar2 ---- progressBar2.setValue(50); progressBar2.setStringPainted(true); - progressBar2.putClientProperty("FlatLaf.styleClass", "flatlaf-preview-progressbar"); + progressBar2.putClientProperty(FlatClientProperties.STYLE_CLASS, "flatlaf-preview-progressbar"); add(progressBar2, "cell 1 18 2 1"); //---- toolTipLabel ---- @@ -777,7 +777,7 @@ class FlatThemePreviewAll //---- toolTip1 ---- toolTip1.setTipText("Some text in tool tip."); - toolTip1.putClientProperty("FlatLaf.styleClass", "flatlaf-preview-tooltip"); + toolTip1.putClientProperty(FlatClientProperties.STYLE_CLASS, "flatlaf-preview-tooltip"); add(toolTip1, "cell 1 19 2 1,alignx left,growx 0"); //---- toolBarLabel ---- @@ -786,39 +786,39 @@ class FlatThemePreviewAll //======== toolBar1 ======== { - toolBar1.putClientProperty("FlatLaf.styleClass", "flatlaf-preview-toolbar"); + toolBar1.putClientProperty(FlatClientProperties.STYLE_CLASS, "flatlaf-preview-toolbar"); //---- button4 ---- button4.setIcon(UIManager.getIcon("Tree.closedIcon")); - button4.putClientProperty("FlatLaf.styleClass", "flatlaf-preview-toolbar-button"); + button4.putClientProperty(FlatClientProperties.STYLE_CLASS, "flatlaf-preview-toolbar-button"); toolBar1.add(button4); //---- button6 ---- button6.setIcon(UIManager.getIcon("Tree.openIcon")); - button6.putClientProperty("FlatLaf.styleClass", "flatlaf-preview-toolbar-button"); + button6.putClientProperty(FlatClientProperties.STYLE_CLASS, "flatlaf-preview-toolbar-button"); toolBar1.add(button6); toolBar1.addSeparator(); //---- button7 ---- button7.setIcon(UIManager.getIcon("Tree.leafIcon")); - button7.putClientProperty("FlatLaf.styleClass", "flatlaf-preview-toolbar-togglebutton"); + button7.putClientProperty(FlatClientProperties.STYLE_CLASS, "flatlaf-preview-toolbar-togglebutton"); toolBar1.add(button7); //---- button8 ---- button8.setIcon(UIManager.getIcon("Tree.leafIcon")); - button8.putClientProperty("FlatLaf.styleClass", "flatlaf-preview-toolbar-togglebutton"); + button8.putClientProperty(FlatClientProperties.STYLE_CLASS, "flatlaf-preview-toolbar-togglebutton"); toolBar1.add(button8); //---- button9 ---- button9.setIcon(UIManager.getIcon("Tree.leafIcon")); button9.setSelected(true); - button9.putClientProperty("FlatLaf.styleClass", "flatlaf-preview-toolbar-togglebutton"); + button9.putClientProperty(FlatClientProperties.STYLE_CLASS, "flatlaf-preview-toolbar-togglebutton"); toolBar1.add(button9); //---- button10 ---- button10.setIcon(UIManager.getIcon("Tree.leafIcon")); button10.setSelected(true); - button10.putClientProperty("FlatLaf.styleClass", "flatlaf-preview-toolbar-togglebutton"); + button10.putClientProperty(FlatClientProperties.STYLE_CLASS, "flatlaf-preview-toolbar-togglebutton"); toolBar1.add(button10); } add(toolBar1, "cell 1 20 2 1"); @@ -829,7 +829,7 @@ class FlatThemePreviewAll //======== tabbedPane1 ======== { - tabbedPane1.putClientProperty("FlatLaf.styleClass", "flatlaf-preview-tabbedpane"); + tabbedPane1.putClientProperty(FlatClientProperties.STYLE_CLASS, "flatlaf-preview-tabbedpane"); } add(tabbedPane1, "cell 1 21 2 1"); @@ -840,7 +840,7 @@ class FlatThemePreviewAll //======== splitPane1 ======== { splitPane1.setResizeWeight(0.5); - splitPane1.putClientProperty("FlatLaf.styleClass", "flatlaf-preview-splitpane"); + splitPane1.putClientProperty(FlatClientProperties.STYLE_CLASS, "flatlaf-preview-splitpane"); //======== scrollPane2 ======== { @@ -858,7 +858,7 @@ class FlatThemePreviewAll @Override public String getElementAt(int i) { return values[i]; } }); - list1.putClientProperty("FlatLaf.styleClass", "flatlaf-preview-list"); + list1.putClientProperty(FlatClientProperties.STYLE_CLASS, "flatlaf-preview-list"); scrollPane2.setViewportView(list1); } splitPane1.setLeftComponent(scrollPane2); @@ -879,7 +879,7 @@ class FlatThemePreviewAll add(node1); } })); - tree1.putClientProperty("FlatLaf.styleClass", "flatlaf-preview-tree"); + tree1.putClientProperty(FlatClientProperties.STYLE_CLASS, "flatlaf-preview-tree"); scrollPane3.setViewportView(tree1); } splitPane1.setRightComponent(scrollPane3); @@ -903,7 +903,7 @@ class FlatThemePreviewAll "Column 1", "Column 2" } )); - table1.putClientProperty("FlatLaf.styleClass", "flatlaf-preview-table"); + table1.putClientProperty(FlatClientProperties.STYLE_CLASS, "flatlaf-preview-table"); scrollPane4.setViewportView(table1); } add(scrollPane4, "cell 1 23 2 1,width 100,height 70"); @@ -914,7 +914,7 @@ class FlatThemePreviewAll //======== desktopPane1 ======== { - desktopPane1.putClientProperty("FlatLaf.styleClass", "flatlaf-preview-desktoppane"); + desktopPane1.putClientProperty(FlatClientProperties.STYLE_CLASS, "flatlaf-preview-desktoppane"); //======== internalFrame1 ======== { @@ -924,7 +924,7 @@ class FlatThemePreviewAll internalFrame1.setMaximizable(true); internalFrame1.setIconifiable(true); internalFrame1.setResizable(true); - internalFrame1.putClientProperty("FlatLaf.styleClass", "flatlaf-preview-internalframe"); + internalFrame1.putClientProperty(FlatClientProperties.STYLE_CLASS, "flatlaf-preview-internalframe"); Container internalFrame1ContentPane = internalFrame1.getContentPane(); internalFrame1ContentPane.setLayout(new BorderLayout()); } @@ -939,7 +939,7 @@ class FlatThemePreviewAll internalFrame2.setMaximizable(true); internalFrame2.setResizable(true); internalFrame2.setTitle("Inactive"); - internalFrame2.putClientProperty("FlatLaf.styleClass", "flatlaf-preview-internalframe"); + internalFrame2.putClientProperty(FlatClientProperties.STYLE_CLASS, "flatlaf-preview-internalframe"); Container internalFrame2ContentPane = internalFrame2.getContentPane(); internalFrame2ContentPane.setLayout(new BorderLayout()); } diff --git a/flatlaf-theme-editor/src/main/java/com/formdev/flatlaf/themeeditor/FlatThemePreviewButtons.java b/flatlaf-theme-editor/src/main/java/com/formdev/flatlaf/themeeditor/FlatThemePreviewButtons.java index ccd57b71..1ccb3e1f 100644 --- a/flatlaf-theme-editor/src/main/java/com/formdev/flatlaf/themeeditor/FlatThemePreviewButtons.java +++ b/flatlaf-theme-editor/src/main/java/com/formdev/flatlaf/themeeditor/FlatThemePreviewButtons.java @@ -21,6 +21,7 @@ import java.awt.Component; import java.util.Objects; import java.util.function.Predicate; import javax.swing.*; +import com.formdev.flatlaf.FlatClientProperties; import net.miginfocom.swing.*; /** @@ -232,25 +233,25 @@ class FlatThemePreviewButtons //---- noneButton ---- noneButton.setText("none"); noneButton.setSelected(true); - noneButton.putClientProperty("FlatLaf.styleClass", "small"); + noneButton.putClientProperty(FlatClientProperties.STYLE_CLASS, "small"); noneButton.addActionListener(e -> buttonTypeChanged()); buttonTypeToolBar1.add(noneButton); //---- squareButton ---- squareButton.setText("square"); - squareButton.putClientProperty("FlatLaf.styleClass", "small"); + squareButton.putClientProperty(FlatClientProperties.STYLE_CLASS, "small"); squareButton.addActionListener(e -> buttonTypeChanged()); buttonTypeToolBar1.add(squareButton); //---- roundRectButton ---- roundRectButton.setText("roundRect"); - roundRectButton.putClientProperty("FlatLaf.styleClass", "small"); + roundRectButton.putClientProperty(FlatClientProperties.STYLE_CLASS, "small"); roundRectButton.addActionListener(e -> buttonTypeChanged()); buttonTypeToolBar1.add(roundRectButton); //---- tabButton ---- tabButton.setText("tab"); - tabButton.putClientProperty("FlatLaf.styleClass", "small"); + tabButton.putClientProperty(FlatClientProperties.STYLE_CLASS, "small"); tabButton.addActionListener(e -> buttonTypeChanged()); buttonTypeToolBar1.add(tabButton); } @@ -263,13 +264,13 @@ class FlatThemePreviewButtons //---- toolBarButtonButton ---- toolBarButtonButton.setText("toolBarButton"); - toolBarButtonButton.putClientProperty("FlatLaf.styleClass", "small"); + toolBarButtonButton.putClientProperty(FlatClientProperties.STYLE_CLASS, "small"); toolBarButtonButton.addActionListener(e -> buttonTypeChanged()); buttonTypeToolBar2.add(toolBarButtonButton); //---- borderlessButton ---- borderlessButton.setText("borderless"); - borderlessButton.putClientProperty("FlatLaf.styleClass", "small"); + borderlessButton.putClientProperty(FlatClientProperties.STYLE_CLASS, "small"); borderlessButton.addActionListener(e -> buttonTypeChanged()); buttonTypeToolBar2.add(borderlessButton); } @@ -279,7 +280,7 @@ class FlatThemePreviewButtons //---- label11 ---- label11.setText("JButton"); - label11.putClientProperty("FlatLaf.styleClass", "h3"); + label11.putClientProperty(FlatClientProperties.STYLE_CLASS, "h3"); add(label11, "cell 0 1 3 1"); //---- label27 ---- @@ -292,22 +293,22 @@ class FlatThemePreviewButtons //---- label5 ---- label5.setText("regular"); - label5.putClientProperty("FlatLaf.styleClass", "small"); + label5.putClientProperty(FlatClientProperties.STYLE_CLASS, "small"); add(label5, "cell 1 3,alignx center,growx 0"); //---- label7 ---- label7.setText("default"); - label7.putClientProperty("FlatLaf.styleClass", "small"); + label7.putClientProperty(FlatClientProperties.STYLE_CLASS, "small"); add(label7, "cell 2 3,alignx center,growx 0"); //---- label6 ---- label6.setText("regular"); - label6.putClientProperty("FlatLaf.styleClass", "small"); + label6.putClientProperty(FlatClientProperties.STYLE_CLASS, "small"); add(label6, "cell 3 3,alignx center,growx 0"); //---- label8 ---- label8.setText("default"); - label8.putClientProperty("FlatLaf.styleClass", "small"); + label8.putClientProperty(FlatClientProperties.STYLE_CLASS, "small"); add(label8, "cell 4 3,alignx center,growx 0"); //---- label1 ---- @@ -316,26 +317,26 @@ class FlatThemePreviewButtons //---- testStateButton1 ---- testStateButton1.setText("OK"); - testStateButton1.putClientProperty("JComponent.minimumWidth", 0); + testStateButton1.putClientProperty(FlatClientProperties.MINIMUM_WIDTH, 0); add(testStateButton1, "cell 1 4"); //---- testStateButton7 ---- testStateButton7.setText("OK"); testStateButton7.setStateDefault(true); - testStateButton7.putClientProperty("JComponent.minimumWidth", 0); + testStateButton7.putClientProperty(FlatClientProperties.MINIMUM_WIDTH, 0); add(testStateButton7, "cell 2 4"); //---- testStateButton4 ---- testStateButton4.setText("OK"); testStateButton4.setStateFocused(true); - testStateButton4.putClientProperty("JComponent.minimumWidth", 0); + testStateButton4.putClientProperty(FlatClientProperties.MINIMUM_WIDTH, 0); add(testStateButton4, "cell 3 4"); //---- testStateButton10 ---- testStateButton10.setText("OK"); testStateButton10.setStateFocused(true); testStateButton10.setStateDefault(true); - testStateButton10.putClientProperty("JComponent.minimumWidth", 0); + testStateButton10.putClientProperty(FlatClientProperties.MINIMUM_WIDTH, 0); add(testStateButton10, "cell 4 4"); //---- label2 ---- @@ -345,21 +346,21 @@ class FlatThemePreviewButtons //---- testStateButton2 ---- testStateButton2.setText("OK"); testStateButton2.setStateHover(true); - testStateButton2.putClientProperty("JComponent.minimumWidth", 0); + testStateButton2.putClientProperty(FlatClientProperties.MINIMUM_WIDTH, 0); add(testStateButton2, "cell 1 5"); //---- testStateButton8 ---- testStateButton8.setText("OK"); testStateButton8.setStateHover(true); testStateButton8.setStateDefault(true); - testStateButton8.putClientProperty("JComponent.minimumWidth", 0); + testStateButton8.putClientProperty(FlatClientProperties.MINIMUM_WIDTH, 0); add(testStateButton8, "cell 2 5"); //---- testStateButton5 ---- testStateButton5.setText("OK"); testStateButton5.setStateHover(true); testStateButton5.setStateFocused(true); - testStateButton5.putClientProperty("JComponent.minimumWidth", 0); + testStateButton5.putClientProperty(FlatClientProperties.MINIMUM_WIDTH, 0); add(testStateButton5, "cell 3 5"); //---- testStateButton11 ---- @@ -367,7 +368,7 @@ class FlatThemePreviewButtons testStateButton11.setStateHover(true); testStateButton11.setStateFocused(true); testStateButton11.setStateDefault(true); - testStateButton11.putClientProperty("JComponent.minimumWidth", 0); + testStateButton11.putClientProperty(FlatClientProperties.MINIMUM_WIDTH, 0); add(testStateButton11, "cell 4 5"); //---- label3 ---- @@ -377,21 +378,21 @@ class FlatThemePreviewButtons //---- testStateButton3 ---- testStateButton3.setText("OK"); testStateButton3.setStatePressed(true); - testStateButton3.putClientProperty("JComponent.minimumWidth", 0); + testStateButton3.putClientProperty(FlatClientProperties.MINIMUM_WIDTH, 0); add(testStateButton3, "cell 1 6"); //---- testStateButton9 ---- testStateButton9.setText("OK"); testStateButton9.setStatePressed(true); testStateButton9.setStateDefault(true); - testStateButton9.putClientProperty("JComponent.minimumWidth", 0); + testStateButton9.putClientProperty(FlatClientProperties.MINIMUM_WIDTH, 0); add(testStateButton9, "cell 2 6"); //---- testStateButton6 ---- testStateButton6.setText("OK"); testStateButton6.setStatePressed(true); testStateButton6.setStateFocused(true); - testStateButton6.putClientProperty("JComponent.minimumWidth", 0); + testStateButton6.putClientProperty(FlatClientProperties.MINIMUM_WIDTH, 0); add(testStateButton6, "cell 3 6"); //---- testStateButton12 ---- @@ -399,7 +400,7 @@ class FlatThemePreviewButtons testStateButton12.setStatePressed(true); testStateButton12.setStateFocused(true); testStateButton12.setStateDefault(true); - testStateButton12.putClientProperty("JComponent.minimumWidth", 0); + testStateButton12.putClientProperty(FlatClientProperties.MINIMUM_WIDTH, 0); add(testStateButton12, "cell 4 6"); //---- label4 ---- @@ -409,14 +410,14 @@ class FlatThemePreviewButtons //---- testStateButton13 ---- testStateButton13.setText("OK"); testStateButton13.setEnabled(false); - testStateButton13.putClientProperty("JComponent.minimumWidth", 0); + testStateButton13.putClientProperty(FlatClientProperties.MINIMUM_WIDTH, 0); add(testStateButton13, "cell 1 7"); //---- testStateButton14 ---- testStateButton14.setText("OK"); testStateButton14.setEnabled(false); testStateButton14.setStateDefault(true); - testStateButton14.putClientProperty("JComponent.minimumWidth", 0); + testStateButton14.putClientProperty(FlatClientProperties.MINIMUM_WIDTH, 0); add(testStateButton14, "cell 2 7"); //---- label10 ---- @@ -425,17 +426,17 @@ class FlatThemePreviewButtons //---- button1 ---- button1.setText("OK"); - button1.putClientProperty("JComponent.minimumWidth", 0); + button1.putClientProperty(FlatClientProperties.MINIMUM_WIDTH, 0); add(button1, "cell 1 8"); //---- testDefaultButton1 ---- testDefaultButton1.setText("OK"); - testDefaultButton1.putClientProperty("JComponent.minimumWidth", 0); + testDefaultButton1.putClientProperty(FlatClientProperties.MINIMUM_WIDTH, 0); add(testDefaultButton1, "cell 2 8"); //---- label12 ---- label12.setText("JToggleButton"); - label12.putClientProperty("FlatLaf.styleClass", "h3"); + label12.putClientProperty(FlatClientProperties.STYLE_CLASS, "h3"); add(label12, "cell 0 9 3 1"); //---- label29 ---- @@ -448,22 +449,22 @@ class FlatThemePreviewButtons //---- label13 ---- label13.setText("unsel."); - label13.putClientProperty("FlatLaf.styleClass", "small"); + label13.putClientProperty(FlatClientProperties.STYLE_CLASS, "small"); add(label13, "cell 1 11,alignx center,growx 0"); //---- label14 ---- label14.setText("selected"); - label14.putClientProperty("FlatLaf.styleClass", "small"); + label14.putClientProperty(FlatClientProperties.STYLE_CLASS, "small"); add(label14, "cell 2 11,alignx center,growx 0"); //---- label15 ---- label15.setText("unsel."); - label15.putClientProperty("FlatLaf.styleClass", "small"); + label15.putClientProperty(FlatClientProperties.STYLE_CLASS, "small"); add(label15, "cell 3 11,alignx center,growx 0"); //---- label16 ---- label16.setText("selected"); - label16.putClientProperty("FlatLaf.styleClass", "small"); + label16.putClientProperty(FlatClientProperties.STYLE_CLASS, "small"); add(label16, "cell 4 11,alignx center,growx 0"); //---- label17 ---- @@ -576,7 +577,7 @@ class FlatThemePreviewButtons //---- label32 ---- label32.setText("Help Button"); - label32.putClientProperty("FlatLaf.styleClass", "h3"); + label32.putClientProperty(FlatClientProperties.STYLE_CLASS, "h3"); add(label32, "cell 0 17 2 1"); //---- label9 ---- @@ -592,14 +593,14 @@ class FlatThemePreviewButtons add(label22, "cell 0 19"); //---- testStateButton15 ---- - testStateButton15.putClientProperty("JComponent.minimumWidth", 0); - testStateButton15.putClientProperty("JButton.buttonType", "help"); + testStateButton15.putClientProperty(FlatClientProperties.MINIMUM_WIDTH, 0); + testStateButton15.putClientProperty(FlatClientProperties.BUTTON_TYPE, FlatClientProperties.BUTTON_TYPE_HELP); add(testStateButton15, "cell 1 19 2 1,alignx center,growx 0"); //---- testStateButton19 ---- testStateButton19.setStateFocused(true); - testStateButton19.putClientProperty("JComponent.minimumWidth", 0); - testStateButton19.putClientProperty("JButton.buttonType", "help"); + testStateButton19.putClientProperty(FlatClientProperties.MINIMUM_WIDTH, 0); + testStateButton19.putClientProperty(FlatClientProperties.BUTTON_TYPE, FlatClientProperties.BUTTON_TYPE_HELP); add(testStateButton19, "cell 3 19 2 1,alignx center,growx 0"); //---- label23 ---- @@ -608,15 +609,15 @@ class FlatThemePreviewButtons //---- testStateButton16 ---- testStateButton16.setStateHover(true); - testStateButton16.putClientProperty("JComponent.minimumWidth", 0); - testStateButton16.putClientProperty("JButton.buttonType", "help"); + testStateButton16.putClientProperty(FlatClientProperties.MINIMUM_WIDTH, 0); + testStateButton16.putClientProperty(FlatClientProperties.BUTTON_TYPE, FlatClientProperties.BUTTON_TYPE_HELP); add(testStateButton16, "cell 1 20 2 1,alignx center,growx 0"); //---- testStateButton20 ---- testStateButton20.setStateHover(true); testStateButton20.setStateFocused(true); - testStateButton20.putClientProperty("JComponent.minimumWidth", 0); - testStateButton20.putClientProperty("JButton.buttonType", "help"); + testStateButton20.putClientProperty(FlatClientProperties.MINIMUM_WIDTH, 0); + testStateButton20.putClientProperty(FlatClientProperties.BUTTON_TYPE, FlatClientProperties.BUTTON_TYPE_HELP); add(testStateButton20, "cell 3 20 2 1,alignx center,growx 0"); //---- label24 ---- @@ -625,15 +626,15 @@ class FlatThemePreviewButtons //---- testStateButton17 ---- testStateButton17.setStatePressed(true); - testStateButton17.putClientProperty("JComponent.minimumWidth", 0); - testStateButton17.putClientProperty("JButton.buttonType", "help"); + testStateButton17.putClientProperty(FlatClientProperties.MINIMUM_WIDTH, 0); + testStateButton17.putClientProperty(FlatClientProperties.BUTTON_TYPE, FlatClientProperties.BUTTON_TYPE_HELP); add(testStateButton17, "cell 1 21 2 1,alignx center,growx 0"); //---- testStateButton21 ---- testStateButton21.setStatePressed(true); testStateButton21.setStateFocused(true); - testStateButton21.putClientProperty("JComponent.minimumWidth", 0); - testStateButton21.putClientProperty("JButton.buttonType", "help"); + testStateButton21.putClientProperty(FlatClientProperties.MINIMUM_WIDTH, 0); + testStateButton21.putClientProperty(FlatClientProperties.BUTTON_TYPE, FlatClientProperties.BUTTON_TYPE_HELP); add(testStateButton21, "cell 3 21 2 1,alignx center,growx 0"); //---- label25 ---- @@ -642,8 +643,8 @@ class FlatThemePreviewButtons //---- testStateButton18 ---- testStateButton18.setEnabled(false); - testStateButton18.putClientProperty("JComponent.minimumWidth", 0); - testStateButton18.putClientProperty("JButton.buttonType", "help"); + testStateButton18.putClientProperty(FlatClientProperties.MINIMUM_WIDTH, 0); + testStateButton18.putClientProperty(FlatClientProperties.BUTTON_TYPE, FlatClientProperties.BUTTON_TYPE_HELP); add(testStateButton18, "cell 1 22 2 1,alignx center,growx 0"); //---- label26 ---- @@ -651,8 +652,8 @@ class FlatThemePreviewButtons add(label26, "cell 0 23"); //---- button2 ---- - button2.putClientProperty("JComponent.minimumWidth", 0); - button2.putClientProperty("JButton.buttonType", "help"); + button2.putClientProperty(FlatClientProperties.MINIMUM_WIDTH, 0); + button2.putClientProperty(FlatClientProperties.BUTTON_TYPE, FlatClientProperties.BUTTON_TYPE_HELP); add(button2, "cell 1 23 2 1,alignx center,growx 0"); //---- buttonGroup1 ---- diff --git a/flatlaf-theme-editor/src/main/java/com/formdev/flatlaf/themeeditor/FlatThemePreviewFonts.java b/flatlaf-theme-editor/src/main/java/com/formdev/flatlaf/themeeditor/FlatThemePreviewFonts.java index e604c8c7..c830d9bd 100644 --- a/flatlaf-theme-editor/src/main/java/com/formdev/flatlaf/themeeditor/FlatThemePreviewFonts.java +++ b/flatlaf-theme-editor/src/main/java/com/formdev/flatlaf/themeeditor/FlatThemePreviewFonts.java @@ -85,7 +85,7 @@ public class FlatThemePreviewFonts //---- headingsLabel ---- headingsLabel.setText("Headings"); - headingsLabel.putClientProperty("FlatLaf.styleClass", "h3"); + headingsLabel.putClientProperty(FlatClientProperties.STYLE_CLASS, "h3"); add(headingsLabel, "cell 0 0"); //---- h00Preview ---- @@ -123,7 +123,7 @@ public class FlatThemePreviewFonts //---- textLabel ---- textLabel.setText("Text"); - textLabel.putClientProperty("FlatLaf.styleClass", "h3"); + textLabel.putClientProperty(FlatClientProperties.STYLE_CLASS, "h3"); add(textLabel, "cell 0 7"); //---- largePreview ---- @@ -171,7 +171,7 @@ public class FlatThemePreviewFonts //---- scaleValueLabel ---- scaleValueLabel.setText("1x"); - scaleValueLabel.putClientProperty("FlatLaf.styleClass", "h2"); + scaleValueLabel.putClientProperty(FlatClientProperties.STYLE_CLASS, "h2"); add(scaleValueLabel, "cell 0 16"); // JFormDesigner - End of component initialization //GEN-END:initComponents } @@ -275,7 +275,7 @@ public class FlatThemePreviewFonts //---- descLabel ---- descLabel.setText("description"); - descLabel.putClientProperty("FlatLaf.styleClass", "medium"); + descLabel.putClientProperty(FlatClientProperties.STYLE_CLASS, "medium"); add(descLabel, "cell 1 0"); // JFormDesigner - End of component initialization //GEN-END:initComponents } diff --git a/flatlaf-theme-editor/src/main/java/com/formdev/flatlaf/themeeditor/FlatThemePreviewSwitches.java b/flatlaf-theme-editor/src/main/java/com/formdev/flatlaf/themeeditor/FlatThemePreviewSwitches.java index 2baa7576..6c840b76 100644 --- a/flatlaf-theme-editor/src/main/java/com/formdev/flatlaf/themeeditor/FlatThemePreviewSwitches.java +++ b/flatlaf-theme-editor/src/main/java/com/formdev/flatlaf/themeeditor/FlatThemePreviewSwitches.java @@ -262,25 +262,25 @@ class FlatThemePreviewSwitches //---- zoom1xButton ---- zoom1xButton.setText("1x"); zoom1xButton.setSelected(true); - zoom1xButton.putClientProperty("FlatLaf.styleClass", "small"); + zoom1xButton.putClientProperty(FlatClientProperties.STYLE_CLASS, "small"); zoom1xButton.addActionListener(e -> zoomChanged()); zoomToolBar.add(zoom1xButton); //---- zoom2xButton ---- zoom2xButton.setText("2x"); - zoom2xButton.putClientProperty("FlatLaf.styleClass", "small"); + zoom2xButton.putClientProperty(FlatClientProperties.STYLE_CLASS, "small"); zoom2xButton.addActionListener(e -> zoomChanged()); zoomToolBar.add(zoom2xButton); //---- zoom3xButton ---- zoom3xButton.setText("3x"); - zoom3xButton.putClientProperty("FlatLaf.styleClass", "small"); + zoom3xButton.putClientProperty(FlatClientProperties.STYLE_CLASS, "small"); zoom3xButton.addActionListener(e -> zoomChanged()); zoomToolBar.add(zoom3xButton); //---- zoom4xButton ---- zoom4xButton.setText("4x"); - zoom4xButton.putClientProperty("FlatLaf.styleClass", "small"); + zoom4xButton.putClientProperty(FlatClientProperties.STYLE_CLASS, "small"); zoom4xButton.addActionListener(e -> zoomChanged()); zoomToolBar.add(zoom4xButton); zoomToolBar.addSeparator(); @@ -288,7 +288,7 @@ class FlatThemePreviewSwitches //---- indeterminateButton ---- indeterminateButton.setText("indeterminate"); indeterminateButton.setSelected(true); - indeterminateButton.putClientProperty("FlatLaf.styleClass", "small"); + indeterminateButton.putClientProperty(FlatClientProperties.STYLE_CLASS, "small"); indeterminateButton.addActionListener(e -> indeterminateChanged()); zoomToolBar.add(indeterminateButton); } @@ -298,7 +298,7 @@ class FlatThemePreviewSwitches //---- label22 ---- label22.setText("JCheckBox"); - label22.putClientProperty("FlatLaf.styleClass", "h3"); + label22.putClientProperty(FlatClientProperties.STYLE_CLASS, "h3"); add(label22, "cell 0 1 3 1"); //---- label1 ---- @@ -311,32 +311,32 @@ class FlatThemePreviewSwitches //---- label23 ---- label23.setText("unsel."); - label23.putClientProperty("FlatLaf.styleClass", "small"); + label23.putClientProperty(FlatClientProperties.STYLE_CLASS, "small"); add(label23, "cell 1 3,alignx center,growx 0"); //---- label28 ---- label28.setText("sel."); - label28.putClientProperty("FlatLaf.styleClass", "small"); + label28.putClientProperty(FlatClientProperties.STYLE_CLASS, "small"); add(label28, "cell 2 3,alignx center,growx 0"); //---- label37 ---- label37.setText("ind."); - label37.putClientProperty("FlatLaf.styleClass", "small"); + label37.putClientProperty(FlatClientProperties.STYLE_CLASS, "small"); add(label37, "cell 3 3,alignx center,growx 0"); //---- label24 ---- label24.setText("unsel."); - label24.putClientProperty("FlatLaf.styleClass", "small"); + label24.putClientProperty(FlatClientProperties.STYLE_CLASS, "small"); add(label24, "cell 4 3,alignx center,growx 0"); //---- label29 ---- label29.setText("sel."); - label29.putClientProperty("FlatLaf.styleClass", "small"); + label29.putClientProperty(FlatClientProperties.STYLE_CLASS, "small"); add(label29, "cell 5 3,alignx center,growx 0"); //---- label38 ---- label38.setText("ind."); - label38.putClientProperty("FlatLaf.styleClass", "small"); + label38.putClientProperty(FlatClientProperties.STYLE_CLASS, "small"); add(label38, "cell 6 3,alignx center,growx 0"); //---- label17 ---- @@ -466,7 +466,7 @@ class FlatThemePreviewSwitches //---- label27 ---- label27.setText("JRadioButton"); - label27.putClientProperty("FlatLaf.styleClass", "h3"); + label27.putClientProperty(FlatClientProperties.STYLE_CLASS, "h3"); add(label27, "cell 0 9 3 1"); //---- label3 ---- @@ -479,22 +479,22 @@ class FlatThemePreviewSwitches //---- label25 ---- label25.setText("unsel."); - label25.putClientProperty("FlatLaf.styleClass", "small"); + label25.putClientProperty(FlatClientProperties.STYLE_CLASS, "small"); add(label25, "cell 1 11,alignx center,growx 0"); //---- label30 ---- label30.setText("sel."); - label30.putClientProperty("FlatLaf.styleClass", "small"); + label30.putClientProperty(FlatClientProperties.STYLE_CLASS, "small"); add(label30, "cell 2 11,alignx center,growx 0"); //---- label26 ---- label26.setText("unsel."); - label26.putClientProperty("FlatLaf.styleClass", "small"); + label26.putClientProperty(FlatClientProperties.STYLE_CLASS, "small"); add(label26, "cell 4 11,alignx center,growx 0"); //---- label31 ---- label31.setText("sel."); - label31.putClientProperty("FlatLaf.styleClass", "small"); + label31.putClientProperty(FlatClientProperties.STYLE_CLASS, "small"); add(label31, "cell 5 11,alignx center,growx 0"); //---- label36 ----