diff --git a/flatlaf-demo/src/main/java/com/formdev/flatlaf/demo/DemoFrame.java b/flatlaf-demo/src/main/java/com/formdev/flatlaf/demo/DemoFrame.java index be913508..83c77380 100644 --- a/flatlaf-demo/src/main/java/com/formdev/flatlaf/demo/DemoFrame.java +++ b/flatlaf-demo/src/main/java/com/formdev/flatlaf/demo/DemoFrame.java @@ -29,6 +29,7 @@ import java.util.prefs.Preferences; import javax.swing.*; import javax.swing.text.DefaultEditorKit; import javax.swing.text.StyleContext; +import com.formdev.flatlaf.FlatClientProperties; import com.formdev.flatlaf.FlatDarculaLaf; import com.formdev.flatlaf.FlatDarkLaf; import com.formdev.flatlaf.FlatIntelliJLaf; @@ -49,7 +50,6 @@ import com.formdev.flatlaf.ui.JBRCustomDecorations; import com.formdev.flatlaf.util.ColorFunctions; import com.formdev.flatlaf.util.LoggingFacade; import com.formdev.flatlaf.util.SystemInfo; -import com.formdev.flatlaf.util.UIScale; import net.miginfocom.layout.ConstraintParser; import net.miginfocom.layout.LC; import net.miginfocom.layout.UnitValue; @@ -143,8 +143,7 @@ class DemoFrame private void aboutActionPerformed() { JLabel titleLabel = new JLabel( "FlatLaf Demo" ); - Font titleFont = titleLabel.getFont(); - titleLabel.setFont( titleFont.deriveFont( (float) titleFont.getSize() + UIScale.scale( 6 ) ) ); + titleLabel.putClientProperty( FlatClientProperties.STYLE_CLASS, "h1" ); String link = "https://www.formdev.com/flatlaf/"; JLabel linkLabel = new JLabel( "" + link + "" ); 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 067a2cde..ea2f01b5 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 @@ -435,7 +435,7 @@ class TabsPanel //---- tabPlacementLabel ---- tabPlacementLabel.setText("Tab placement"); - tabPlacementLabel.setFont(tabPlacementLabel.getFont().deriveFont(tabPlacementLabel.getFont().getSize() + 4f)); + tabPlacementLabel.putClientProperty("FlatLaf.styleClass", "h3"); tabPlacementLabel.setName("tabPlacementLabel"); panel1.add(tabPlacementLabel, "cell 0 0"); @@ -448,28 +448,28 @@ class TabsPanel //---- topPlacementButton ---- topPlacementButton.setText("top"); topPlacementButton.setSelected(true); - topPlacementButton.setFont(topPlacementButton.getFont().deriveFont(topPlacementButton.getFont().getSize() - 2f)); + topPlacementButton.putClientProperty("FlatLaf.styleClass", "small"); topPlacementButton.setName("topPlacementButton"); topPlacementButton.addActionListener(e -> tabPlacementChanged()); tabPlacementToolBar.add(topPlacementButton); //---- bottomPlacementButton ---- bottomPlacementButton.setText("bottom"); - bottomPlacementButton.setFont(bottomPlacementButton.getFont().deriveFont(bottomPlacementButton.getFont().getSize() - 2f)); + bottomPlacementButton.putClientProperty("FlatLaf.styleClass", "small"); bottomPlacementButton.setName("bottomPlacementButton"); bottomPlacementButton.addActionListener(e -> tabPlacementChanged()); tabPlacementToolBar.add(bottomPlacementButton); //---- leftPlacementButton ---- leftPlacementButton.setText("left"); - leftPlacementButton.setFont(leftPlacementButton.getFont().deriveFont(leftPlacementButton.getFont().getSize() - 2f)); + leftPlacementButton.putClientProperty("FlatLaf.styleClass", "small"); leftPlacementButton.setName("leftPlacementButton"); leftPlacementButton.addActionListener(e -> tabPlacementChanged()); tabPlacementToolBar.add(leftPlacementButton); //---- rightPlacementButton ---- rightPlacementButton.setText("right"); - rightPlacementButton.setFont(rightPlacementButton.getFont().deriveFont(rightPlacementButton.getFont().getSize() - 2f)); + rightPlacementButton.putClientProperty("FlatLaf.styleClass", "small"); rightPlacementButton.setName("rightPlacementButton"); rightPlacementButton.addActionListener(e -> tabPlacementChanged()); tabPlacementToolBar.add(rightPlacementButton); @@ -477,14 +477,14 @@ class TabsPanel //---- scrollButton ---- scrollButton.setText("scroll"); - scrollButton.setFont(scrollButton.getFont().deriveFont(scrollButton.getFont().getSize() - 2f)); + scrollButton.putClientProperty("FlatLaf.styleClass", "small"); scrollButton.setName("scrollButton"); scrollButton.addActionListener(e -> scrollChanged()); tabPlacementToolBar.add(scrollButton); //---- borderButton ---- borderButton.setText("border"); - borderButton.setFont(borderButton.getFont().deriveFont(borderButton.getFont().getSize() - 2f)); + borderButton.putClientProperty("FlatLaf.styleClass", "small"); borderButton.setName("borderButton"); borderButton.addActionListener(e -> borderChanged()); tabPlacementToolBar.add(borderButton); @@ -499,7 +499,7 @@ class TabsPanel //---- tabLayoutLabel ---- tabLayoutLabel.setText("Tab layout"); - tabLayoutLabel.setFont(tabLayoutLabel.getFont().deriveFont(tabLayoutLabel.getFont().getSize() + 4f)); + tabLayoutLabel.putClientProperty("FlatLaf.styleClass", "h3"); tabLayoutLabel.setName("tabLayoutLabel"); panel1.add(tabLayoutLabel, "cell 0 2"); @@ -511,15 +511,15 @@ class TabsPanel //---- scrollTabLayoutButton ---- scrollTabLayoutButton.setText("scroll"); - scrollTabLayoutButton.setFont(scrollTabLayoutButton.getFont().deriveFont(scrollTabLayoutButton.getFont().getSize() - 2f)); scrollTabLayoutButton.setSelected(true); + scrollTabLayoutButton.putClientProperty("FlatLaf.styleClass", "small"); scrollTabLayoutButton.setName("scrollTabLayoutButton"); scrollTabLayoutButton.addActionListener(e -> tabLayoutChanged()); tabLayoutToolBar.add(scrollTabLayoutButton); //---- wrapTabLayoutButton ---- wrapTabLayoutButton.setText("wrap"); - wrapTabLayoutButton.setFont(wrapTabLayoutButton.getFont().deriveFont(wrapTabLayoutButton.getFont().getSize() - 2f)); + wrapTabLayoutButton.putClientProperty("FlatLaf.styleClass", "small"); wrapTabLayoutButton.setName("wrapTabLayoutButton"); wrapTabLayoutButton.addActionListener(e -> tabLayoutChanged()); tabLayoutToolBar.add(wrapTabLayoutButton); @@ -529,14 +529,14 @@ class TabsPanel //---- scrollLayoutNoteLabel ---- scrollLayoutNoteLabel.setText("(use mouse wheel to scroll; arrow button shows hidden tabs)"); scrollLayoutNoteLabel.setEnabled(false); - scrollLayoutNoteLabel.setFont(scrollLayoutNoteLabel.getFont().deriveFont(scrollLayoutNoteLabel.getFont().getSize() - 2f)); + scrollLayoutNoteLabel.putClientProperty("FlatLaf.styleClass", "small"); scrollLayoutNoteLabel.setName("scrollLayoutNoteLabel"); panel1.add(scrollLayoutNoteLabel, "cell 0 3"); //---- wrapLayoutNoteLabel ---- wrapLayoutNoteLabel.setText("(probably better to use scroll layout?)"); wrapLayoutNoteLabel.setEnabled(false); - wrapLayoutNoteLabel.setFont(wrapLayoutNoteLabel.getFont().deriveFont(wrapLayoutNoteLabel.getFont().getSize() - 2f)); + wrapLayoutNoteLabel.putClientProperty("FlatLaf.styleClass", "small"); wrapLayoutNoteLabel.setName("wrapLayoutNoteLabel"); panel1.add(wrapLayoutNoteLabel, "cell 0 3"); @@ -554,7 +554,7 @@ class TabsPanel //---- closableTabsLabel ---- closableTabsLabel.setText("Closable tabs"); - closableTabsLabel.setFont(closableTabsLabel.getFont().deriveFont(closableTabsLabel.getFont().getSize() + 4f)); + closableTabsLabel.putClientProperty("FlatLaf.styleClass", "h3"); closableTabsLabel.setName("closableTabsLabel"); panel1.add(closableTabsLabel, "cell 0 5"); @@ -566,22 +566,22 @@ class TabsPanel //---- squareCloseButton ---- squareCloseButton.setText("square"); - squareCloseButton.setFont(squareCloseButton.getFont().deriveFont(squareCloseButton.getFont().getSize() - 2f)); squareCloseButton.setSelected(true); + squareCloseButton.putClientProperty("FlatLaf.styleClass", "small"); squareCloseButton.setName("squareCloseButton"); squareCloseButton.addActionListener(e -> closeButtonStyleChanged()); closableTabsToolBar.add(squareCloseButton); //---- circleCloseButton ---- circleCloseButton.setText("circle"); - circleCloseButton.setFont(circleCloseButton.getFont().deriveFont(circleCloseButton.getFont().getSize() - 2f)); + circleCloseButton.putClientProperty("FlatLaf.styleClass", "small"); circleCloseButton.setName("circleCloseButton"); circleCloseButton.addActionListener(e -> closeButtonStyleChanged()); closableTabsToolBar.add(circleCloseButton); //---- redCrossCloseButton ---- redCrossCloseButton.setText("red cross"); - redCrossCloseButton.setFont(redCrossCloseButton.getFont().deriveFont(redCrossCloseButton.getFont().getSize() - 2f)); + redCrossCloseButton.putClientProperty("FlatLaf.styleClass", "small"); redCrossCloseButton.setName("redCrossCloseButton"); redCrossCloseButton.addActionListener(e -> closeButtonStyleChanged()); closableTabsToolBar.add(redCrossCloseButton); @@ -596,7 +596,7 @@ class TabsPanel //---- tabAreaComponentsLabel ---- tabAreaComponentsLabel.setText("Custom tab area components"); - tabAreaComponentsLabel.setFont(tabAreaComponentsLabel.getFont().deriveFont(tabAreaComponentsLabel.getFont().getSize() + 4f)); + tabAreaComponentsLabel.putClientProperty("FlatLaf.styleClass", "h3"); tabAreaComponentsLabel.setName("tabAreaComponentsLabel"); panel1.add(tabAreaComponentsLabel, "cell 0 7"); @@ -608,16 +608,16 @@ class TabsPanel //---- leadingComponentButton ---- leadingComponentButton.setText("leading"); - leadingComponentButton.setFont(leadingComponentButton.getFont().deriveFont(leadingComponentButton.getFont().getSize() - 2f)); leadingComponentButton.setSelected(true); + leadingComponentButton.putClientProperty("FlatLaf.styleClass", "small"); leadingComponentButton.setName("leadingComponentButton"); leadingComponentButton.addActionListener(e -> customComponentsChanged()); tabAreaComponentsToolBar.add(leadingComponentButton); //---- trailingComponentButton ---- trailingComponentButton.setText("trailing"); - trailingComponentButton.setFont(trailingComponentButton.getFont().deriveFont(trailingComponentButton.getFont().getSize() - 2f)); trailingComponentButton.setSelected(true); + trailingComponentButton.putClientProperty("FlatLaf.styleClass", "small"); trailingComponentButton.setName("trailingComponentButton"); trailingComponentButton.addActionListener(e -> customComponentsChanged()); tabAreaComponentsToolBar.add(trailingComponentButton); @@ -655,14 +655,14 @@ class TabsPanel //---- tabIconPlacementLabel ---- tabIconPlacementLabel.setText("Tab icon placement"); - tabIconPlacementLabel.setFont(tabIconPlacementLabel.getFont().deriveFont(tabIconPlacementLabel.getFont().getSize() + 4f)); + tabIconPlacementLabel.putClientProperty("FlatLaf.styleClass", "h3"); tabIconPlacementLabel.setName("tabIconPlacementLabel"); panel2.add(tabIconPlacementLabel, "cell 0 0"); //---- tabIconPlacementNodeLabel ---- tabIconPlacementNodeLabel.setText("(top/bottom/leading/trailing)"); tabIconPlacementNodeLabel.setEnabled(false); - tabIconPlacementNodeLabel.setFont(tabIconPlacementNodeLabel.getFont().deriveFont(tabIconPlacementNodeLabel.getFont().getSize() - 2f)); + tabIconPlacementNodeLabel.putClientProperty("FlatLaf.styleClass", "small"); tabIconPlacementNodeLabel.setName("tabIconPlacementNodeLabel"); panel2.add(tabIconPlacementNodeLabel, "cell 0 1"); @@ -692,14 +692,14 @@ class TabsPanel //---- tabAreaAlignmentLabel ---- tabAreaAlignmentLabel.setText("Tab area alignment"); - tabAreaAlignmentLabel.setFont(tabAreaAlignmentLabel.getFont().deriveFont(tabAreaAlignmentLabel.getFont().getSize() + 4f)); + tabAreaAlignmentLabel.putClientProperty("FlatLaf.styleClass", "h3"); tabAreaAlignmentLabel.setName("tabAreaAlignmentLabel"); panel2.add(tabAreaAlignmentLabel, "cell 0 6"); //---- tabAreaAlignmentNoteLabel ---- tabAreaAlignmentNoteLabel.setText("(leading/center/trailing/fill)"); tabAreaAlignmentNoteLabel.setEnabled(false); - tabAreaAlignmentNoteLabel.setFont(tabAreaAlignmentNoteLabel.getFont().deriveFont(tabAreaAlignmentNoteLabel.getFont().getSize() - 2f)); + tabAreaAlignmentNoteLabel.putClientProperty("FlatLaf.styleClass", "small"); tabAreaAlignmentNoteLabel.setName("tabAreaAlignmentNoteLabel"); panel2.add(tabAreaAlignmentNoteLabel, "cell 0 7"); @@ -750,14 +750,14 @@ class TabsPanel //---- tabWidthModeLabel ---- tabWidthModeLabel.setText("Tab width mode"); - tabWidthModeLabel.setFont(tabWidthModeLabel.getFont().deriveFont(tabWidthModeLabel.getFont().getSize() + 4f)); + tabWidthModeLabel.putClientProperty("FlatLaf.styleClass", "h3"); tabWidthModeLabel.setName("tabWidthModeLabel"); panel3.add(tabWidthModeLabel, "cell 0 0"); //---- tabWidthModeNoteLabel ---- tabWidthModeNoteLabel.setText("(preferred/equal/compact)"); - tabWidthModeNoteLabel.setFont(tabWidthModeNoteLabel.getFont().deriveFont(tabWidthModeNoteLabel.getFont().getSize() - 2f)); tabWidthModeNoteLabel.setEnabled(false); + tabWidthModeNoteLabel.putClientProperty("FlatLaf.styleClass", "small"); tabWidthModeNoteLabel.setName("tabWidthModeNoteLabel"); panel3.add(tabWidthModeNoteLabel, "cell 0 1"); @@ -781,7 +781,7 @@ class TabsPanel //---- minMaxTabWidthLabel ---- minMaxTabWidthLabel.setText("Minimum/maximum tab width"); - minMaxTabWidthLabel.setFont(minMaxTabWidthLabel.getFont().deriveFont(minMaxTabWidthLabel.getFont().getSize() + 4f)); + minMaxTabWidthLabel.putClientProperty("FlatLaf.styleClass", "h3"); minMaxTabWidthLabel.setName("minMaxTabWidthLabel"); panel3.add(minMaxTabWidthLabel, "cell 0 5"); @@ -799,7 +799,7 @@ class TabsPanel //---- tabAlignmentLabel ---- tabAlignmentLabel.setText("Tab title alignment"); - tabAlignmentLabel.setFont(tabAlignmentLabel.getFont().deriveFont(tabAlignmentLabel.getFont().getSize() + 4f)); + tabAlignmentLabel.putClientProperty("FlatLaf.styleClass", "h3"); tabAlignmentLabel.setName("tabAlignmentLabel"); panel3.add(tabAlignmentLabel, "cell 0 8"); @@ -820,14 +820,14 @@ class TabsPanel //---- tabAlignmentNoteLabel ---- tabAlignmentNoteLabel.setText("(leading/center/trailing)"); tabAlignmentNoteLabel.setEnabled(false); - tabAlignmentNoteLabel.setFont(tabAlignmentNoteLabel.getFont().deriveFont(tabAlignmentNoteLabel.getFont().getSize() - 2f)); + tabAlignmentNoteLabel.putClientProperty("FlatLaf.styleClass", "small"); tabAlignmentNoteLabel.setName("tabAlignmentNoteLabel"); panel5.add(tabAlignmentNoteLabel, "cell 0 0"); //---- tabAlignmentNoteLabel2 ---- tabAlignmentNoteLabel2.setText("(trailing)"); tabAlignmentNoteLabel2.setEnabled(false); - tabAlignmentNoteLabel2.setFont(tabAlignmentNoteLabel2.getFont().deriveFont(tabAlignmentNoteLabel2.getFont().getSize() - 2f)); + tabAlignmentNoteLabel2.putClientProperty("FlatLaf.styleClass", "small"); tabAlignmentNoteLabel2.setName("tabAlignmentNoteLabel2"); panel5.add(tabAlignmentNoteLabel2, "cell 1 0,alignx right,growx 0"); @@ -891,22 +891,22 @@ class TabsPanel //---- scrollAsNeededSingleButton ---- scrollAsNeededSingleButton.setText("asNeededSingle"); - scrollAsNeededSingleButton.setFont(scrollAsNeededSingleButton.getFont().deriveFont(scrollAsNeededSingleButton.getFont().getSize() - 2f)); scrollAsNeededSingleButton.setSelected(true); + scrollAsNeededSingleButton.putClientProperty("FlatLaf.styleClass", "small"); scrollAsNeededSingleButton.setName("scrollAsNeededSingleButton"); scrollAsNeededSingleButton.addActionListener(e -> scrollButtonsPolicyChanged()); scrollButtonsPolicyToolBar.add(scrollAsNeededSingleButton); //---- scrollAsNeededButton ---- scrollAsNeededButton.setText("asNeeded"); - scrollAsNeededButton.setFont(scrollAsNeededButton.getFont().deriveFont(scrollAsNeededButton.getFont().getSize() - 2f)); + scrollAsNeededButton.putClientProperty("FlatLaf.styleClass", "small"); scrollAsNeededButton.setName("scrollAsNeededButton"); scrollAsNeededButton.addActionListener(e -> scrollButtonsPolicyChanged()); scrollButtonsPolicyToolBar.add(scrollAsNeededButton); //---- scrollNeverButton ---- scrollNeverButton.setText("never"); - scrollNeverButton.setFont(scrollNeverButton.getFont().deriveFont(scrollNeverButton.getFont().getSize() - 2f)); + scrollNeverButton.putClientProperty("FlatLaf.styleClass", "small"); scrollNeverButton.setName("scrollNeverButton"); scrollNeverButton.addActionListener(e -> scrollButtonsPolicyChanged()); scrollButtonsPolicyToolBar.add(scrollNeverButton); @@ -926,15 +926,15 @@ class TabsPanel //---- scrollBothButton ---- scrollBothButton.setText("both"); - scrollBothButton.setFont(scrollBothButton.getFont().deriveFont(scrollBothButton.getFont().getSize() - 2f)); scrollBothButton.setSelected(true); + scrollBothButton.putClientProperty("FlatLaf.styleClass", "small"); scrollBothButton.setName("scrollBothButton"); scrollBothButton.addActionListener(e -> scrollButtonsPlacementChanged()); scrollButtonsPlacementToolBar.add(scrollBothButton); //---- scrollTrailingButton ---- scrollTrailingButton.setText("trailing"); - scrollTrailingButton.setFont(scrollTrailingButton.getFont().deriveFont(scrollTrailingButton.getFont().getSize() - 2f)); + scrollTrailingButton.putClientProperty("FlatLaf.styleClass", "small"); scrollTrailingButton.setName("scrollTrailingButton"); scrollTrailingButton.addActionListener(e -> scrollButtonsPlacementChanged()); scrollButtonsPlacementToolBar.add(scrollTrailingButton); @@ -954,15 +954,15 @@ class TabsPanel //---- popupAsNeededButton ---- popupAsNeededButton.setText("asNeeded"); - popupAsNeededButton.setFont(popupAsNeededButton.getFont().deriveFont(popupAsNeededButton.getFont().getSize() - 2f)); popupAsNeededButton.setSelected(true); + popupAsNeededButton.putClientProperty("FlatLaf.styleClass", "small"); popupAsNeededButton.setName("popupAsNeededButton"); popupAsNeededButton.addActionListener(e -> tabsPopupPolicyChanged()); tabsPopupPolicyToolBar.add(popupAsNeededButton); //---- popupNeverButton ---- popupNeverButton.setText("never"); - popupNeverButton.setFont(popupNeverButton.getFont().deriveFont(popupNeverButton.getFont().getSize() - 2f)); + popupNeverButton.putClientProperty("FlatLaf.styleClass", "small"); popupNeverButton.setName("popupNeverButton"); popupNeverButton.addActionListener(e -> tabsPopupPolicyChanged()); tabsPopupPolicyToolBar.add(popupNeverButton); diff --git a/flatlaf-demo/src/main/java/com/formdev/flatlaf/demo/TabsPanel.jfd b/flatlaf-demo/src/main/java/com/formdev/flatlaf/demo/TabsPanel.jfd index 3f634b86..e3c79173 100644 --- a/flatlaf-demo/src/main/java/com/formdev/flatlaf/demo/TabsPanel.jfd +++ b/flatlaf-demo/src/main/java/com/formdev/flatlaf/demo/TabsPanel.jfd @@ -1,4 +1,4 @@ -JFDML JFormDesigner: "7.0.2.0.298" Java: "15" encoding: "UTF-8" +JFDML JFormDesigner: "7.0.5.0.382" Java: "16" encoding: "UTF-8" new FormModel { contentType: "form/swing" @@ -22,7 +22,7 @@ new FormModel { add( new FormComponent( "javax.swing.JLabel" ) { name: "tabPlacementLabel" "text": "Tab placement" - "font": new com.jformdesigner.model.SwingDerivedFont( null, 0, 4, false ) + "$client.FlatLaf.styleClass": "h3" auxiliary() { "JavaCodeGenerator.variableLocal": true } @@ -38,28 +38,28 @@ new FormModel { "text": "top" "selected": true "$buttonGroup": new FormReference( "tabPlacementButtonGroup" ) - "font": &SwingDerivedFont0 new com.jformdesigner.model.SwingDerivedFont( null, 0, -2, false ) + "$client.FlatLaf.styleClass": "small" addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "tabPlacementChanged", false ) ) } ) add( new FormComponent( "javax.swing.JToggleButton" ) { name: "bottomPlacementButton" "text": "bottom" "$buttonGroup": new FormReference( "tabPlacementButtonGroup" ) - "font": #SwingDerivedFont0 + "$client.FlatLaf.styleClass": "small" addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "tabPlacementChanged", false ) ) } ) add( new FormComponent( "javax.swing.JToggleButton" ) { name: "leftPlacementButton" "text": "left" "$buttonGroup": new FormReference( "tabPlacementButtonGroup" ) - "font": #SwingDerivedFont0 + "$client.FlatLaf.styleClass": "small" addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "tabPlacementChanged", false ) ) } ) add( new FormComponent( "javax.swing.JToggleButton" ) { name: "rightPlacementButton" "text": "right" "$buttonGroup": new FormReference( "tabPlacementButtonGroup" ) - "font": #SwingDerivedFont0 + "$client.FlatLaf.styleClass": "small" addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "tabPlacementChanged", false ) ) } ) add( new FormComponent( "javax.swing.JToolBar$Separator" ) { @@ -68,13 +68,13 @@ new FormModel { add( new FormComponent( "javax.swing.JToggleButton" ) { name: "scrollButton" "text": "scroll" - "font": new com.jformdesigner.model.SwingDerivedFont( null, 0, -2, false ) + "$client.FlatLaf.styleClass": "small" addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "scrollChanged", false ) ) } ) add( new FormComponent( "javax.swing.JToggleButton" ) { name: "borderButton" "text": "border" - "font": new com.jformdesigner.model.SwingDerivedFont( null, 0, -2, false ) + "$client.FlatLaf.styleClass": "small" addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "borderChanged", false ) ) } ) }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { @@ -88,7 +88,7 @@ new FormModel { add( new FormComponent( "javax.swing.JLabel" ) { name: "tabLayoutLabel" "text": "Tab layout" - "font": &SwingDerivedFont1 new com.jformdesigner.model.SwingDerivedFont( null, 0, 4, false ) + "$client.FlatLaf.styleClass": "h3" auxiliary() { "JavaCodeGenerator.variableLocal": true } @@ -103,15 +103,15 @@ new FormModel { name: "scrollTabLayoutButton" "text": "scroll" "$buttonGroup": new FormReference( "tabLayoutButtonGroup" ) - "font": &SwingDerivedFont2 new com.jformdesigner.model.SwingDerivedFont( null, 0, -2, false ) "selected": true + "$client.FlatLaf.styleClass": "small" addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "tabLayoutChanged", false ) ) } ) add( new FormComponent( "javax.swing.JToggleButton" ) { name: "wrapTabLayoutButton" "text": "wrap" "$buttonGroup": new FormReference( "tabLayoutButtonGroup" ) - "font": #SwingDerivedFont2 + "$client.FlatLaf.styleClass": "small" addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "tabLayoutChanged", false ) ) } ) }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { @@ -121,7 +121,7 @@ new FormModel { name: "scrollLayoutNoteLabel" "text": "(use mouse wheel to scroll; arrow button shows hidden tabs)" "enabled": false - "font": &SwingDerivedFont3 new com.jformdesigner.model.SwingDerivedFont( null, 0, -2, false ) + "$client.FlatLaf.styleClass": "small" }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { "value": "cell 0 3" } ) @@ -129,7 +129,7 @@ new FormModel { name: "wrapLayoutNoteLabel" "text": "(probably better to use scroll layout?)" "enabled": false - "font": #SwingDerivedFont3 + "$client.FlatLaf.styleClass": "small" }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { "value": "cell 0 3" } ) @@ -146,7 +146,7 @@ new FormModel { add( new FormComponent( "javax.swing.JLabel" ) { name: "closableTabsLabel" "text": "Closable tabs" - "font": #SwingDerivedFont1 + "$client.FlatLaf.styleClass": "h3" auxiliary() { "JavaCodeGenerator.variableLocal": true } @@ -160,23 +160,23 @@ new FormModel { add( new FormComponent( "javax.swing.JToggleButton" ) { name: "squareCloseButton" "text": "square" - "font": &SwingDerivedFont4 new com.jformdesigner.model.SwingDerivedFont( null, 0, -2, false ) "$buttonGroup": new FormReference( "closableTabsButtonGroup" ) "selected": true + "$client.FlatLaf.styleClass": "small" addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "closeButtonStyleChanged", false ) ) } ) add( new FormComponent( "javax.swing.JToggleButton" ) { name: "circleCloseButton" "text": "circle" - "font": #SwingDerivedFont4 "$buttonGroup": new FormReference( "closableTabsButtonGroup" ) + "$client.FlatLaf.styleClass": "small" addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "closeButtonStyleChanged", false ) ) } ) add( new FormComponent( "javax.swing.JToggleButton" ) { name: "redCrossCloseButton" "text": "red cross" - "font": #SwingDerivedFont4 "$buttonGroup": new FormReference( "closableTabsButtonGroup" ) + "$client.FlatLaf.styleClass": "small" addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "closeButtonStyleChanged", false ) ) } ) }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { @@ -190,7 +190,7 @@ new FormModel { add( new FormComponent( "javax.swing.JLabel" ) { name: "tabAreaComponentsLabel" "text": "Custom tab area components" - "font": #SwingDerivedFont1 + "$client.FlatLaf.styleClass": "h3" auxiliary() { "JavaCodeGenerator.variableLocal": true } @@ -204,15 +204,15 @@ new FormModel { add( new FormComponent( "javax.swing.JToggleButton" ) { name: "leadingComponentButton" "text": "leading" - "font": &SwingDerivedFont5 new com.jformdesigner.model.SwingDerivedFont( null, 0, -2, false ) "selected": true + "$client.FlatLaf.styleClass": "small" addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "customComponentsChanged", false ) ) } ) add( new FormComponent( "javax.swing.JToggleButton" ) { name: "trailingComponentButton" "text": "trailing" - "font": #SwingDerivedFont5 "selected": true + "$client.FlatLaf.styleClass": "small" addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "customComponentsChanged", false ) ) } ) }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { @@ -238,7 +238,7 @@ new FormModel { add( new FormComponent( "javax.swing.JLabel" ) { name: "tabIconPlacementLabel" "text": "Tab icon placement" - "font": new com.jformdesigner.model.SwingDerivedFont( null, 0, 4, false ) + "$client.FlatLaf.styleClass": "h3" auxiliary() { "JavaCodeGenerator.variableLocal": true } @@ -249,7 +249,7 @@ new FormModel { name: "tabIconPlacementNodeLabel" "text": "(top/bottom/leading/trailing)" "enabled": false - "font": new com.jformdesigner.model.SwingDerivedFont( null, 0, -2, false ) + "$client.FlatLaf.styleClass": "small" auxiliary() { "JavaCodeGenerator.variableLocal": true } @@ -279,7 +279,7 @@ new FormModel { add( new FormComponent( "javax.swing.JLabel" ) { name: "tabAreaAlignmentLabel" "text": "Tab area alignment" - "font": &SwingDerivedFont6 new com.jformdesigner.model.SwingDerivedFont( null, 0, 4, false ) + "$client.FlatLaf.styleClass": "h3" auxiliary() { "JavaCodeGenerator.variableLocal": true } @@ -290,7 +290,7 @@ new FormModel { name: "tabAreaAlignmentNoteLabel" "text": "(leading/center/trailing/fill)" "enabled": false - "font": &SwingDerivedFont7 new com.jformdesigner.model.SwingDerivedFont( null, 0, -2, false ) + "$client.FlatLaf.styleClass": "small" auxiliary() { "JavaCodeGenerator.variableLocal": true } @@ -332,7 +332,7 @@ new FormModel { add( new FormComponent( "javax.swing.JLabel" ) { name: "tabWidthModeLabel" "text": "Tab width mode" - "font": #SwingDerivedFont6 + "$client.FlatLaf.styleClass": "h3" auxiliary() { "JavaCodeGenerator.variableLocal": true } @@ -342,8 +342,8 @@ new FormModel { add( new FormComponent( "javax.swing.JLabel" ) { name: "tabWidthModeNoteLabel" "text": "(preferred/equal/compact)" - "font": new com.jformdesigner.model.SwingDerivedFont( null, 0, -2, false ) "enabled": false + "$client.FlatLaf.styleClass": "small" auxiliary() { "JavaCodeGenerator.variableLocal": true } @@ -368,7 +368,7 @@ new FormModel { add( new FormComponent( "javax.swing.JLabel" ) { name: "minMaxTabWidthLabel" "text": "Minimum/maximum tab width" - "font": new com.jformdesigner.model.SwingDerivedFont( null, 0, 4, false ) + "$client.FlatLaf.styleClass": "h3" auxiliary() { "JavaCodeGenerator.variableLocal": true } @@ -388,7 +388,7 @@ new FormModel { add( new FormComponent( "javax.swing.JLabel" ) { name: "tabAlignmentLabel" "text": "Tab title alignment" - "font": #SwingDerivedFont6 + "$client.FlatLaf.styleClass": "h3" auxiliary() { "JavaCodeGenerator.variableLocal": true } @@ -405,7 +405,7 @@ new FormModel { name: "tabAlignmentNoteLabel" "text": "(leading/center/trailing)" "enabled": false - "font": #SwingDerivedFont7 + "$client.FlatLaf.styleClass": "small" auxiliary() { "JavaCodeGenerator.variableLocal": true } @@ -416,7 +416,7 @@ new FormModel { name: "tabAlignmentNoteLabel2" "text": "(trailing)" "enabled": false - "font": #SwingDerivedFont7 + "$client.FlatLaf.styleClass": "small" auxiliary() { "JavaCodeGenerator.variableLocal": true } @@ -477,23 +477,23 @@ new FormModel { add( new FormComponent( "javax.swing.JToggleButton" ) { name: "scrollAsNeededSingleButton" "text": "asNeededSingle" - "font": #SwingDerivedFont2 "selected": true "$buttonGroup": new FormReference( "scrollButtonsPolicyButtonGroup" ) + "$client.FlatLaf.styleClass": "small" addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "scrollButtonsPolicyChanged", false ) ) } ) add( new FormComponent( "javax.swing.JToggleButton" ) { name: "scrollAsNeededButton" "text": "asNeeded" - "font": #SwingDerivedFont2 "$buttonGroup": new FormReference( "scrollButtonsPolicyButtonGroup" ) + "$client.FlatLaf.styleClass": "small" addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "scrollButtonsPolicyChanged", false ) ) } ) add( new FormComponent( "javax.swing.JToggleButton" ) { name: "scrollNeverButton" "text": "never" - "font": #SwingDerivedFont2 "$buttonGroup": new FormReference( "scrollButtonsPolicyButtonGroup" ) + "$client.FlatLaf.styleClass": "small" addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "scrollButtonsPolicyChanged", false ) ) } ) }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { @@ -512,16 +512,16 @@ new FormModel { add( new FormComponent( "javax.swing.JToggleButton" ) { name: "scrollBothButton" "text": "both" - "font": #SwingDerivedFont2 "selected": true "$buttonGroup": new FormReference( "scrollButtonsPlacementButtonGroup" ) + "$client.FlatLaf.styleClass": "small" addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "scrollButtonsPlacementChanged", false ) ) } ) add( new FormComponent( "javax.swing.JToggleButton" ) { name: "scrollTrailingButton" "text": "trailing" - "font": #SwingDerivedFont2 "$buttonGroup": new FormReference( "scrollButtonsPlacementButtonGroup" ) + "$client.FlatLaf.styleClass": "small" addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "scrollButtonsPlacementChanged", false ) ) } ) }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { @@ -540,16 +540,16 @@ new FormModel { add( new FormComponent( "javax.swing.JToggleButton" ) { name: "popupAsNeededButton" "text": "asNeeded" - "font": #SwingDerivedFont2 "selected": true "$buttonGroup": new FormReference( "tabsPopupPolicyButtonGroup" ) + "$client.FlatLaf.styleClass": "small" addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "tabsPopupPolicyChanged", false ) ) } ) add( new FormComponent( "javax.swing.JToggleButton" ) { name: "popupNeverButton" "text": "never" - "font": #SwingDerivedFont2 "$buttonGroup": new FormReference( "tabsPopupPolicyButtonGroup" ) + "$client.FlatLaf.styleClass": "small" addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "tabsPopupPolicyChanged", false ) ) } ) }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { @@ -570,7 +570,7 @@ new FormModel { } ) }, new FormLayoutConstraints( null ) { "location": new java.awt.Point( 0, 0 ) - "size": new java.awt.Dimension( 1075, 895 ) + "size": new java.awt.Dimension( 1145, 895 ) } ) add( new FormNonVisual( "javax.swing.ButtonGroup" ) { name: "tabPlacementButtonGroup" 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 b457a26f..8f3b7bf4 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.setFont(label11.getFont().deriveFont(label11.getFont().getSize() + 4f)); + label11.putClientProperty("FlatLaf.styleClass", "h3"); add(label11, "cell 1 0 2 1"); //---- label12 ---- label12.setText("JToggleButton"); - label12.setFont(label12.getFont().deriveFont(label12.getFont().getSize() + 4f)); + label12.putClientProperty("FlatLaf.styleClass", "h3"); add(label12, "cell 5 0 3 1"); //---- label32 ---- label32.setText("Help Button"); - label32.setFont(label32.getFont().deriveFont(label32.getFont().getSize() + 4f)); + label32.putClientProperty("FlatLaf.styleClass", "h3"); add(label32, "cell 9 0 2 1"); //---- label5 ---- @@ -513,12 +513,12 @@ public class FlatComponentStateTest //---- label22 ---- label22.setText("JCheckBox"); - label22.setFont(label22.getFont().deriveFont(label22.getFont().getSize() + 4f)); + label22.putClientProperty("FlatLaf.styleClass", "h3"); add(label22, "cell 1 8 2 1"); //---- label27 ---- label27.setText("JRadioButton"); - label27.setFont(label27.getFont().deriveFont(label27.getFont().getSize() + 4f)); + label27.putClientProperty("FlatLaf.styleClass", "h3"); add(label27, "cell 5 8 2 1"); //---- label23 ---- diff --git a/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatComponentStateTest.jfd b/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatComponentStateTest.jfd index f0af5569..2798e3bf 100644 --- a/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatComponentStateTest.jfd +++ b/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatComponentStateTest.jfd @@ -12,21 +12,21 @@ new FormModel { add( new FormComponent( "javax.swing.JLabel" ) { name: "label11" "text": "JButton" - "font": &SwingDerivedFont0 new com.jformdesigner.model.SwingDerivedFont( null, 0, 4, false ) + "$client.FlatLaf.styleClass": "h3" }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { "value": "cell 1 0 2 1" } ) add( new FormComponent( "javax.swing.JLabel" ) { name: "label12" "text": "JToggleButton" - "font": #SwingDerivedFont0 + "$client.FlatLaf.styleClass": "h3" }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { "value": "cell 5 0 3 1" } ) add( new FormComponent( "javax.swing.JLabel" ) { name: "label32" "text": "Help Button" - "font": #SwingDerivedFont0 + "$client.FlatLaf.styleClass": "h3" }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { "value": "cell 9 0 2 1" } ) @@ -447,14 +447,14 @@ new FormModel { add( new FormComponent( "javax.swing.JLabel" ) { name: "label22" "text": "JCheckBox" - "font": #SwingDerivedFont0 + "$client.FlatLaf.styleClass": "h3" }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { "value": "cell 1 8 2 1" } ) add( new FormComponent( "javax.swing.JLabel" ) { name: "label27" "text": "JRadioButton" - "font": #SwingDerivedFont0 + "$client.FlatLaf.styleClass": "h3" }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { "value": "cell 5 8 2 1" } ) diff --git a/flatlaf-theme-editor/src/main/java/com/formdev/flatlaf/themeeditor/FlatThemeFileEditor.java b/flatlaf-theme-editor/src/main/java/com/formdev/flatlaf/themeeditor/FlatThemeFileEditor.java index 0e6cdf80..77245adc 100644 --- a/flatlaf-theme-editor/src/main/java/com/formdev/flatlaf/themeeditor/FlatThemeFileEditor.java +++ b/flatlaf-theme-editor/src/main/java/com/formdev/flatlaf/themeeditor/FlatThemeFileEditor.java @@ -25,7 +25,6 @@ import java.awt.Cursor; import java.awt.Desktop; import java.awt.Dimension; import java.awt.EventQueue; -import java.awt.Font; import java.awt.Graphics; import java.awt.GraphicsConfiguration; import java.awt.Insets; @@ -52,6 +51,7 @@ import java.util.prefs.Preferences; import javax.lang.model.SourceVersion; import javax.swing.*; import net.miginfocom.swing.*; +import com.formdev.flatlaf.FlatClientProperties; import com.formdev.flatlaf.FlatDarculaLaf; import com.formdev.flatlaf.FlatDarkLaf; import com.formdev.flatlaf.FlatIntelliJLaf; @@ -734,8 +734,7 @@ class FlatThemeFileEditor private void about() { JLabel titleLabel = new JLabel( "FlatLaf Theme Editor" ); - Font titleFont = titleLabel.getFont(); - titleLabel.setFont( titleFont.deriveFont( (float) titleFont.getSize() + UIScale.scale( 6 ) ) ); + titleLabel.putClientProperty( FlatClientProperties.STYLE_CLASS, "h1" ); String link = "https://www.formdev.com/flatlaf/"; JLabel linkLabel = new JLabel( "" + link + "" ); 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 2225e10b..aa3b4767 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 @@ -222,8 +222,8 @@ class FlatThemePreview add(previewSeparator, BorderLayout.LINE_START); //---- previewLabel ---- - previewLabel.setText(" Preview "); - previewLabel.setFont(previewLabel.getFont().deriveFont(previewLabel.getFont().getSize() + 6f)); + previewLabel.setText(" Preview "); + previewLabel.putClientProperty("FlatLaf.styleClass", "h2"); // JFormDesigner - End of component initialization //GEN-END:initComponents } diff --git a/flatlaf-theme-editor/src/main/java/com/formdev/flatlaf/themeeditor/FlatThemePreview.jfd b/flatlaf-theme-editor/src/main/java/com/formdev/flatlaf/themeeditor/FlatThemePreview.jfd index 3aaca34f..202fa0e8 100644 --- a/flatlaf-theme-editor/src/main/java/com/formdev/flatlaf/themeeditor/FlatThemePreview.jfd +++ b/flatlaf-theme-editor/src/main/java/com/formdev/flatlaf/themeeditor/FlatThemePreview.jfd @@ -24,8 +24,8 @@ new FormModel { } ) add( new FormComponent( "javax.swing.JLabel" ) { name: "previewLabel" - "text": " Preview " - "font": new com.jformdesigner.model.SwingDerivedFont( null, 0, 6, false ) + "text": " Preview " + "$client.FlatLaf.styleClass": "h2" }, new FormLayoutConstraints( null ) { "location": new java.awt.Point( 0, 235 ) "size": new java.awt.Dimension( 176, 24 ) 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 30eece47..df64d93c 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 @@ -560,7 +560,7 @@ class FlatThemePreviewAll menuUnderlineSelectionButton.setButtonType(FlatButton.ButtonType.toolBarButton); menuUnderlineSelectionButton.setToolTipText("menu underline selection"); menuUnderlineSelectionButton.setFocusable(false); - menuUnderlineSelectionButton.setFont(menuUnderlineSelectionButton.getFont().deriveFont(menuUnderlineSelectionButton.getFont().getSize() - 2f)); + menuUnderlineSelectionButton.putClientProperty("FlatLaf.styleClass", "small"); menuUnderlineSelectionButton.addActionListener(e -> menuUnderlineSelectionChanged()); add(menuUnderlineSelectionButton, "cell 0 11"); diff --git a/flatlaf-theme-editor/src/main/java/com/formdev/flatlaf/themeeditor/FlatThemePreviewAll.jfd b/flatlaf-theme-editor/src/main/java/com/formdev/flatlaf/themeeditor/FlatThemePreviewAll.jfd index 1a25ffb7..0d3ae4cb 100644 --- a/flatlaf-theme-editor/src/main/java/com/formdev/flatlaf/themeeditor/FlatThemePreviewAll.jfd +++ b/flatlaf-theme-editor/src/main/java/com/formdev/flatlaf/themeeditor/FlatThemePreviewAll.jfd @@ -307,7 +307,7 @@ new FormModel { "buttonType": enum com.formdev.flatlaf.extras.components.FlatButton$ButtonType toolBarButton "toolTipText": "menu underline selection" "focusable": false - "font": new com.jformdesigner.model.SwingDerivedFont( null, 0, -2, false ) + "$client.FlatLaf.styleClass": "small" auxiliary() { "JavaCodeGenerator.variableLocal": false } 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 07e294b6..ccd57b71 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 @@ -232,25 +232,25 @@ class FlatThemePreviewButtons //---- noneButton ---- noneButton.setText("none"); noneButton.setSelected(true); - noneButton.setFont(noneButton.getFont().deriveFont(noneButton.getFont().getSize() - 2f)); + noneButton.putClientProperty("FlatLaf.styleClass", "small"); noneButton.addActionListener(e -> buttonTypeChanged()); buttonTypeToolBar1.add(noneButton); //---- squareButton ---- squareButton.setText("square"); - squareButton.setFont(squareButton.getFont().deriveFont(squareButton.getFont().getSize() - 2f)); + squareButton.putClientProperty("FlatLaf.styleClass", "small"); squareButton.addActionListener(e -> buttonTypeChanged()); buttonTypeToolBar1.add(squareButton); //---- roundRectButton ---- roundRectButton.setText("roundRect"); - roundRectButton.setFont(roundRectButton.getFont().deriveFont(roundRectButton.getFont().getSize() - 2f)); + roundRectButton.putClientProperty("FlatLaf.styleClass", "small"); roundRectButton.addActionListener(e -> buttonTypeChanged()); buttonTypeToolBar1.add(roundRectButton); //---- tabButton ---- tabButton.setText("tab"); - tabButton.setFont(tabButton.getFont().deriveFont(tabButton.getFont().getSize() - 2f)); + tabButton.putClientProperty("FlatLaf.styleClass", "small"); tabButton.addActionListener(e -> buttonTypeChanged()); buttonTypeToolBar1.add(tabButton); } @@ -263,13 +263,13 @@ class FlatThemePreviewButtons //---- toolBarButtonButton ---- toolBarButtonButton.setText("toolBarButton"); - toolBarButtonButton.setFont(toolBarButtonButton.getFont().deriveFont(toolBarButtonButton.getFont().getSize() - 2f)); + toolBarButtonButton.putClientProperty("FlatLaf.styleClass", "small"); toolBarButtonButton.addActionListener(e -> buttonTypeChanged()); buttonTypeToolBar2.add(toolBarButtonButton); //---- borderlessButton ---- borderlessButton.setText("borderless"); - borderlessButton.setFont(borderlessButton.getFont().deriveFont(borderlessButton.getFont().getSize() - 2f)); + borderlessButton.putClientProperty("FlatLaf.styleClass", "small"); borderlessButton.addActionListener(e -> buttonTypeChanged()); buttonTypeToolBar2.add(borderlessButton); } @@ -279,7 +279,7 @@ class FlatThemePreviewButtons //---- label11 ---- label11.setText("JButton"); - label11.setFont(label11.getFont().deriveFont(label11.getFont().getSize() + 4f)); + label11.putClientProperty("FlatLaf.styleClass", "h3"); add(label11, "cell 0 1 3 1"); //---- label27 ---- @@ -292,22 +292,22 @@ class FlatThemePreviewButtons //---- label5 ---- label5.setText("regular"); - label5.setFont(label5.getFont().deriveFont(label5.getFont().getSize() - 2f)); + label5.putClientProperty("FlatLaf.styleClass", "small"); add(label5, "cell 1 3,alignx center,growx 0"); //---- label7 ---- label7.setText("default"); - label7.setFont(label7.getFont().deriveFont(label7.getFont().getSize() - 2f)); + label7.putClientProperty("FlatLaf.styleClass", "small"); add(label7, "cell 2 3,alignx center,growx 0"); //---- label6 ---- label6.setText("regular"); - label6.setFont(label6.getFont().deriveFont(label6.getFont().getSize() - 2f)); + label6.putClientProperty("FlatLaf.styleClass", "small"); add(label6, "cell 3 3,alignx center,growx 0"); //---- label8 ---- label8.setText("default"); - label8.setFont(label8.getFont().deriveFont(label8.getFont().getSize() - 2f)); + label8.putClientProperty("FlatLaf.styleClass", "small"); add(label8, "cell 4 3,alignx center,growx 0"); //---- label1 ---- @@ -435,7 +435,7 @@ class FlatThemePreviewButtons //---- label12 ---- label12.setText("JToggleButton"); - label12.setFont(label12.getFont().deriveFont(label12.getFont().getSize() + 4f)); + label12.putClientProperty("FlatLaf.styleClass", "h3"); add(label12, "cell 0 9 3 1"); //---- label29 ---- @@ -448,22 +448,22 @@ class FlatThemePreviewButtons //---- label13 ---- label13.setText("unsel."); - label13.setFont(label13.getFont().deriveFont(label13.getFont().getSize() - 2f)); + label13.putClientProperty("FlatLaf.styleClass", "small"); add(label13, "cell 1 11,alignx center,growx 0"); //---- label14 ---- label14.setText("selected"); - label14.setFont(label14.getFont().deriveFont(label14.getFont().getSize() - 2f)); + label14.putClientProperty("FlatLaf.styleClass", "small"); add(label14, "cell 2 11,alignx center,growx 0"); //---- label15 ---- label15.setText("unsel."); - label15.setFont(label15.getFont().deriveFont(label15.getFont().getSize() - 2f)); + label15.putClientProperty("FlatLaf.styleClass", "small"); add(label15, "cell 3 11,alignx center,growx 0"); //---- label16 ---- label16.setText("selected"); - label16.setFont(label16.getFont().deriveFont(label16.getFont().getSize() - 2f)); + label16.putClientProperty("FlatLaf.styleClass", "small"); add(label16, "cell 4 11,alignx center,growx 0"); //---- label17 ---- @@ -576,7 +576,7 @@ class FlatThemePreviewButtons //---- label32 ---- label32.setText("Help Button"); - label32.setFont(label32.getFont().deriveFont(label32.getFont().getSize() + 4f)); + label32.putClientProperty("FlatLaf.styleClass", "h3"); add(label32, "cell 0 17 2 1"); //---- label9 ---- diff --git a/flatlaf-theme-editor/src/main/java/com/formdev/flatlaf/themeeditor/FlatThemePreviewButtons.jfd b/flatlaf-theme-editor/src/main/java/com/formdev/flatlaf/themeeditor/FlatThemePreviewButtons.jfd index b4cb937d..f7f49429 100644 --- a/flatlaf-theme-editor/src/main/java/com/formdev/flatlaf/themeeditor/FlatThemePreviewButtons.jfd +++ b/flatlaf-theme-editor/src/main/java/com/formdev/flatlaf/themeeditor/FlatThemePreviewButtons.jfd @@ -33,7 +33,7 @@ new FormModel { "text": "none" "$buttonGroup": new FormReference( "buttonGroup1" ) "selected": true - "font": &SwingDerivedFont0 new com.jformdesigner.model.SwingDerivedFont( null, 0, -2, false ) + "$client.FlatLaf.styleClass": "small" auxiliary() { "JavaCodeGenerator.variableLocal": false } @@ -43,7 +43,7 @@ new FormModel { name: "squareButton" "text": "square" "$buttonGroup": new FormReference( "buttonGroup1" ) - "font": #SwingDerivedFont0 + "$client.FlatLaf.styleClass": "small" auxiliary() { "JavaCodeGenerator.variableLocal": false } @@ -53,7 +53,7 @@ new FormModel { name: "roundRectButton" "text": "roundRect" "$buttonGroup": new FormReference( "buttonGroup1" ) - "font": #SwingDerivedFont0 + "$client.FlatLaf.styleClass": "small" auxiliary() { "JavaCodeGenerator.variableLocal": false } @@ -63,7 +63,7 @@ new FormModel { name: "tabButton" "text": "tab" "$buttonGroup": new FormReference( "buttonGroup1" ) - "font": #SwingDerivedFont0 + "$client.FlatLaf.styleClass": "small" auxiliary() { "JavaCodeGenerator.variableLocal": false } @@ -80,7 +80,7 @@ new FormModel { name: "toolBarButtonButton" "text": "toolBarButton" "$buttonGroup": new FormReference( "buttonGroup1" ) - "font": #SwingDerivedFont0 + "$client.FlatLaf.styleClass": "small" auxiliary() { "JavaCodeGenerator.variableLocal": false } @@ -90,7 +90,7 @@ new FormModel { name: "borderlessButton" "text": "borderless" "$buttonGroup": new FormReference( "buttonGroup1" ) - "font": #SwingDerivedFont0 + "$client.FlatLaf.styleClass": "small" auxiliary() { "JavaCodeGenerator.variableLocal": false } @@ -105,7 +105,7 @@ new FormModel { add( new FormComponent( "javax.swing.JLabel" ) { name: "label11" "text": "JButton" - "font": &SwingDerivedFont1 new com.jformdesigner.model.SwingDerivedFont( null, 0, 4, false ) + "$client.FlatLaf.styleClass": "h3" }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { "value": "cell 0 1 3 1" } ) @@ -124,28 +124,28 @@ new FormModel { add( new FormComponent( "javax.swing.JLabel" ) { name: "label5" "text": "regular" - "font": &SwingDerivedFont2 new com.jformdesigner.model.SwingDerivedFont( null, 0, -2, false ) + "$client.FlatLaf.styleClass": "small" }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { "value": "cell 1 3,alignx center,growx 0" } ) add( new FormComponent( "javax.swing.JLabel" ) { name: "label7" "text": "default" - "font": #SwingDerivedFont2 + "$client.FlatLaf.styleClass": "small" }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { "value": "cell 2 3,alignx center,growx 0" } ) add( new FormComponent( "javax.swing.JLabel" ) { name: "label6" "text": "regular" - "font": #SwingDerivedFont2 + "$client.FlatLaf.styleClass": "small" }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { "value": "cell 3 3,alignx center,growx 0" } ) add( new FormComponent( "javax.swing.JLabel" ) { name: "label8" "text": "default" - "font": #SwingDerivedFont2 + "$client.FlatLaf.styleClass": "small" }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { "value": "cell 4 3,alignx center,growx 0" } ) @@ -317,7 +317,7 @@ new FormModel { add( new FormComponent( "javax.swing.JLabel" ) { name: "label12" "text": "JToggleButton" - "font": #SwingDerivedFont1 + "$client.FlatLaf.styleClass": "h3" }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { "value": "cell 0 9 3 1" } ) @@ -336,28 +336,28 @@ new FormModel { add( new FormComponent( "javax.swing.JLabel" ) { name: "label13" "text": "unsel." - "font": #SwingDerivedFont2 + "$client.FlatLaf.styleClass": "small" }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { "value": "cell 1 11,alignx center,growx 0" } ) add( new FormComponent( "javax.swing.JLabel" ) { name: "label14" "text": "selected" - "font": #SwingDerivedFont2 + "$client.FlatLaf.styleClass": "small" }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { "value": "cell 2 11,alignx center,growx 0" } ) add( new FormComponent( "javax.swing.JLabel" ) { name: "label15" "text": "unsel." - "font": #SwingDerivedFont2 + "$client.FlatLaf.styleClass": "small" }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { "value": "cell 3 11,alignx center,growx 0" } ) add( new FormComponent( "javax.swing.JLabel" ) { name: "label16" "text": "selected" - "font": #SwingDerivedFont2 + "$client.FlatLaf.styleClass": "small" }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { "value": "cell 4 11,alignx center,growx 0" } ) @@ -514,7 +514,7 @@ new FormModel { add( new FormComponent( "javax.swing.JLabel" ) { name: "label32" "text": "Help Button" - "font": #SwingDerivedFont1 + "$client.FlatLaf.styleClass": "h3" }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { "value": "cell 0 17 2 1" } ) 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 775c7122..3de492e1 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 @@ -119,7 +119,7 @@ class FlatThemePreviewSwitches //---- label22 ---- label22.setText("JCheckBox"); - label22.setFont(label22.getFont().deriveFont(label22.getFont().getSize() + 4f)); + label22.putClientProperty("FlatLaf.styleClass", "h3"); add(label22, "cell 0 0 3 1"); //---- label1 ---- @@ -132,22 +132,22 @@ class FlatThemePreviewSwitches //---- label23 ---- label23.setText("unsel."); - label23.setFont(label23.getFont().deriveFont(label23.getFont().getSize() - 2f)); + label23.putClientProperty("FlatLaf.styleClass", "small"); add(label23, "cell 1 2,alignx center,growx 0"); //---- label28 ---- label28.setText("selected"); - label28.setFont(label28.getFont().deriveFont(label28.getFont().getSize() - 2f)); + label28.putClientProperty("FlatLaf.styleClass", "small"); add(label28, "cell 2 2,alignx center,growx 0"); //---- label24 ---- label24.setText("unsel."); - label24.setFont(label24.getFont().deriveFont(label24.getFont().getSize() - 2f)); + label24.putClientProperty("FlatLaf.styleClass", "small"); add(label24, "cell 3 2,alignx center,growx 0"); //---- label29 ---- label29.setText("selected"); - label29.setFont(label29.getFont().deriveFont(label29.getFont().getSize() - 2f)); + label29.putClientProperty("FlatLaf.styleClass", "small"); add(label29, "cell 4 2,alignx center,growx 0"); //---- label17 ---- @@ -260,7 +260,7 @@ class FlatThemePreviewSwitches //---- label27 ---- label27.setText("JRadioButton"); - label27.setFont(label27.getFont().deriveFont(label27.getFont().getSize() + 4f)); + label27.putClientProperty("FlatLaf.styleClass", "h3"); add(label27, "cell 0 8 3 1"); //---- label3 ---- @@ -273,22 +273,22 @@ class FlatThemePreviewSwitches //---- label25 ---- label25.setText("unsel."); - label25.setFont(label25.getFont().deriveFont(label25.getFont().getSize() - 2f)); + label25.putClientProperty("FlatLaf.styleClass", "small"); add(label25, "cell 1 10,alignx center,growx 0"); //---- label30 ---- label30.setText("selected"); - label30.setFont(label30.getFont().deriveFont(label30.getFont().getSize() - 2f)); + label30.putClientProperty("FlatLaf.styleClass", "small"); add(label30, "cell 2 10,alignx center,growx 0"); //---- label26 ---- label26.setText("unsel."); - label26.setFont(label26.getFont().deriveFont(label26.getFont().getSize() - 2f)); + label26.putClientProperty("FlatLaf.styleClass", "small"); add(label26, "cell 3 10,alignx center,growx 0"); //---- label31 ---- label31.setText("selected"); - label31.setFont(label31.getFont().deriveFont(label31.getFont().getSize() - 2f)); + label31.putClientProperty("FlatLaf.styleClass", "small"); add(label31, "cell 4 10,alignx center,growx 0"); //---- label36 ---- diff --git a/flatlaf-theme-editor/src/main/java/com/formdev/flatlaf/themeeditor/FlatThemePreviewSwitches.jfd b/flatlaf-theme-editor/src/main/java/com/formdev/flatlaf/themeeditor/FlatThemePreviewSwitches.jfd index 502633e0..f84d3555 100644 --- a/flatlaf-theme-editor/src/main/java/com/formdev/flatlaf/themeeditor/FlatThemePreviewSwitches.jfd +++ b/flatlaf-theme-editor/src/main/java/com/formdev/flatlaf/themeeditor/FlatThemePreviewSwitches.jfd @@ -15,7 +15,7 @@ new FormModel { add( new FormComponent( "javax.swing.JLabel" ) { name: "label22" "text": "JCheckBox" - "font": &SwingDerivedFont0 new com.jformdesigner.model.SwingDerivedFont( null, 0, 4, false ) + "$client.FlatLaf.styleClass": "h3" }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { "value": "cell 0 0 3 1" } ) @@ -34,28 +34,28 @@ new FormModel { add( new FormComponent( "javax.swing.JLabel" ) { name: "label23" "text": "unsel." - "font": &SwingDerivedFont1 new com.jformdesigner.model.SwingDerivedFont( null, 0, -2, false ) + "$client.FlatLaf.styleClass": "small" }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { "value": "cell 1 2,alignx center,growx 0" } ) add( new FormComponent( "javax.swing.JLabel" ) { name: "label28" "text": "selected" - "font": #SwingDerivedFont1 + "$client.FlatLaf.styleClass": "small" }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { "value": "cell 2 2,alignx center,growx 0" } ) add( new FormComponent( "javax.swing.JLabel" ) { name: "label24" "text": "unsel." - "font": #SwingDerivedFont1 + "$client.FlatLaf.styleClass": "small" }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { "value": "cell 3 2,alignx center,growx 0" } ) add( new FormComponent( "javax.swing.JLabel" ) { name: "label29" "text": "selected" - "font": #SwingDerivedFont1 + "$client.FlatLaf.styleClass": "small" }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { "value": "cell 4 2,alignx center,growx 0" } ) @@ -212,7 +212,7 @@ new FormModel { add( new FormComponent( "javax.swing.JLabel" ) { name: "label27" "text": "JRadioButton" - "font": #SwingDerivedFont0 + "$client.FlatLaf.styleClass": "h3" }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { "value": "cell 0 8 3 1" } ) @@ -231,28 +231,28 @@ new FormModel { add( new FormComponent( "javax.swing.JLabel" ) { name: "label25" "text": "unsel." - "font": #SwingDerivedFont1 + "$client.FlatLaf.styleClass": "small" }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { "value": "cell 1 10,alignx center,growx 0" } ) add( new FormComponent( "javax.swing.JLabel" ) { name: "label30" "text": "selected" - "font": #SwingDerivedFont1 + "$client.FlatLaf.styleClass": "small" }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { "value": "cell 2 10,alignx center,growx 0" } ) add( new FormComponent( "javax.swing.JLabel" ) { name: "label26" "text": "unsel." - "font": #SwingDerivedFont1 + "$client.FlatLaf.styleClass": "small" }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { "value": "cell 3 10,alignx center,growx 0" } ) add( new FormComponent( "javax.swing.JLabel" ) { name: "label31" "text": "selected" - "font": #SwingDerivedFont1 + "$client.FlatLaf.styleClass": "small" }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { "value": "cell 4 10,alignx center,growx 0" } )