From 465af9bc41eb0812245aa9c68dfab8236b7c582f Mon Sep 17 00:00:00 2001 From: Karl Tauber Date: Wed, 13 Oct 2021 10:53:37 +0200 Subject: [PATCH 01/22] Typography: added fonts/styles for headings and various text sizes --- .../com/formdev/flatlaf/FlatLaf.properties | 32 +++++++++ .../uidefaults/FlatDarkLaf_1.8.0_202.txt | 68 +++++++++++++++++++ .../uidefaults/FlatLightLaf_1.8.0_202.txt | 68 +++++++++++++++++++ .../uidefaults/FlatTestLaf_1.8.0_202.txt | 68 +++++++++++++++++++ .../flatlaf/themeeditor/FlatLafUIKeys.txt | 20 ++++++ 5 files changed, 256 insertions(+) diff --git a/flatlaf-core/src/main/resources/com/formdev/flatlaf/FlatLaf.properties b/flatlaf-core/src/main/resources/com/formdev/flatlaf/FlatLaf.properties index ebbb9296..83cbfaf2 100644 --- a/flatlaf-core/src/main/resources/com/formdev/flatlaf/FlatLaf.properties +++ b/flatlaf-core/src/main/resources/com/formdev/flatlaf/FlatLaf.properties @@ -26,6 +26,38 @@ # Instead copy and modify only those properties that you need to alter. # +#---- typography / fonts ---- + +# headings +h00.font = +24 +h0.font = +18 +h1.font = +12 +h2.font = +6 +h3.font = +3 +h4.font = bold + +# text +large.font = +2 +medium.font = -1 +small.font = -2 +mini.font = -3 + +# default font +#defaultFont = ... + +# styles +[style].h00 = font: $h00.font +[style].h0 = font: $h0.font +[style].h1 = font: $h1.font +[style].h2 = font: $h2.font +[style].h3 = font: $h3.font +[style].h4 = font: $h4.font +[style].large = font: $large.font +[style].medium = font: $medium.font +[style].small = font: $small.font +[style].mini = font: $mini.font + + #---- UI delegates ---- ButtonUI = com.formdev.flatlaf.ui.FlatButtonUI diff --git a/flatlaf-testing/dumps/uidefaults/FlatDarkLaf_1.8.0_202.txt b/flatlaf-testing/dumps/uidefaults/FlatDarkLaf_1.8.0_202.txt index 4cb864f1..c939baba 100644 --- a/flatlaf-testing/dumps/uidefaults/FlatDarkLaf_1.8.0_202.txt +++ b/flatlaf-testing/dumps/uidefaults/FlatDarkLaf_1.8.0_202.txt @@ -1381,6 +1381,20 @@ Viewport.foreground #bbbbbb HSL 0 0 73 javax.swing.plaf.Colo ViewportUI com.formdev.flatlaf.ui.FlatViewportUI +#---- [style] ---- + +[style].h00 font: $h00.font +[style].h0 font: $h0.font +[style].h1 font: $h1.font +[style].h2 font: $h2.font +[style].h3 font: $h3.font +[style].h4 font: $h4.font +[style].large font: $large.font +[style].medium font: $medium.font +[style].mini font: $mini.font +[style].small font: $small.font + + #---- ---- activeCaption #434e60 HSL 217 18 32 javax.swing.plaf.ColorUIResource [UI] @@ -1396,6 +1410,36 @@ defaultFont Segoe UI plain 12 javax.swing.plaf.FontUIResou desktop #46494b HSL 204 3 28 javax.swing.plaf.ColorUIResource [UI] +#---- h0 ---- + +h0.font [active] Segoe UI plain 30 javax.swing.plaf.FontUIResource [UI] + + +#---- h00 ---- + +h00.font [active] Segoe UI plain 36 javax.swing.plaf.FontUIResource [UI] + + +#---- h1 ---- + +h1.font [active] Segoe UI plain 24 javax.swing.plaf.FontUIResource [UI] + + +#---- h2 ---- + +h2.font [active] Segoe UI plain 18 javax.swing.plaf.FontUIResource [UI] + + +#---- h3 ---- + +h3.font [active] Segoe UI plain 15 javax.swing.plaf.FontUIResource [UI] + + +#---- h4 ---- + +h4.font [active] Segoe UI bold 12 javax.swing.plaf.FontUIResource [UI] + + #---- html ---- html.missingImage [lazy] 38,38 sun.swing.ImageIconUIResource [UI] (sun.awt.image.ToolkitImage) @@ -1417,13 +1461,37 @@ laf.dark true laf.scaleFactor [active] 1.0 +#---- large ---- + +large.font [active] Segoe UI plain 14 javax.swing.plaf.FontUIResource [UI] + + +#---- medium ---- + +medium.font [active] Segoe UI plain 11 javax.swing.plaf.FontUIResource [UI] + + #---- ---- menu #3c3f41 HSL 204 4 25 javax.swing.plaf.ColorUIResource [UI] menuText #bbbbbb HSL 0 0 73 javax.swing.plaf.ColorUIResource [UI] + + +#---- mini ---- + +mini.font [active] Segoe UI plain 9 javax.swing.plaf.FontUIResource [UI] + + +#---- ---- + scrollbar #3e4244 HSL 200 5 25 com.formdev.flatlaf.util.DerivedColor [UI] lighten(1%) +#---- small ---- + +small.font [active] Segoe UI plain 10 javax.swing.plaf.FontUIResource [UI] + + #---- swingx/TaskPane ---- swingx/TaskPaneUI com.formdev.flatlaf.swingx.ui.FlatTaskPaneUI diff --git a/flatlaf-testing/dumps/uidefaults/FlatLightLaf_1.8.0_202.txt b/flatlaf-testing/dumps/uidefaults/FlatLightLaf_1.8.0_202.txt index 9c078938..5fe0564b 100644 --- a/flatlaf-testing/dumps/uidefaults/FlatLightLaf_1.8.0_202.txt +++ b/flatlaf-testing/dumps/uidefaults/FlatLightLaf_1.8.0_202.txt @@ -1386,6 +1386,20 @@ Viewport.foreground #000000 HSL 0 0 0 javax.swing.plaf.Colo ViewportUI com.formdev.flatlaf.ui.FlatViewportUI +#---- [style] ---- + +[style].h00 font: $h00.font +[style].h0 font: $h0.font +[style].h1 font: $h1.font +[style].h2 font: $h2.font +[style].h3 font: $h3.font +[style].h4 font: $h4.font +[style].large font: $large.font +[style].medium font: $medium.font +[style].mini font: $mini.font +[style].small font: $small.font + + #---- ---- activeCaption #99b4d1 HSL 211 38 71 javax.swing.plaf.ColorUIResource [UI] @@ -1401,6 +1415,36 @@ defaultFont Segoe UI plain 12 javax.swing.plaf.FontUIResou desktop #ffffff HSL 0 0 100 javax.swing.plaf.ColorUIResource [UI] +#---- h0 ---- + +h0.font [active] Segoe UI plain 30 javax.swing.plaf.FontUIResource [UI] + + +#---- h00 ---- + +h00.font [active] Segoe UI plain 36 javax.swing.plaf.FontUIResource [UI] + + +#---- h1 ---- + +h1.font [active] Segoe UI plain 24 javax.swing.plaf.FontUIResource [UI] + + +#---- h2 ---- + +h2.font [active] Segoe UI plain 18 javax.swing.plaf.FontUIResource [UI] + + +#---- h3 ---- + +h3.font [active] Segoe UI plain 15 javax.swing.plaf.FontUIResource [UI] + + +#---- h4 ---- + +h4.font [active] Segoe UI bold 12 javax.swing.plaf.FontUIResource [UI] + + #---- html ---- html.missingImage [lazy] 38,38 sun.swing.ImageIconUIResource [UI] (sun.awt.image.ToolkitImage) @@ -1422,13 +1466,37 @@ laf.dark false laf.scaleFactor [active] 1.0 +#---- large ---- + +large.font [active] Segoe UI plain 14 javax.swing.plaf.FontUIResource [UI] + + +#---- medium ---- + +medium.font [active] Segoe UI plain 11 javax.swing.plaf.FontUIResource [UI] + + #---- ---- menu #f2f2f2 HSL 0 0 95 javax.swing.plaf.ColorUIResource [UI] menuText #000000 HSL 0 0 0 javax.swing.plaf.ColorUIResource [UI] + + +#---- mini ---- + +mini.font [active] Segoe UI plain 9 javax.swing.plaf.FontUIResource [UI] + + +#---- ---- + scrollbar #f5f5f5 HSL 0 0 96 com.formdev.flatlaf.util.DerivedColor [UI] lighten(1%) +#---- small ---- + +small.font [active] Segoe UI plain 10 javax.swing.plaf.FontUIResource [UI] + + #---- swingx/TaskPane ---- swingx/TaskPaneUI com.formdev.flatlaf.swingx.ui.FlatTaskPaneUI diff --git a/flatlaf-testing/dumps/uidefaults/FlatTestLaf_1.8.0_202.txt b/flatlaf-testing/dumps/uidefaults/FlatTestLaf_1.8.0_202.txt index d2eb2d03..4428984e 100644 --- a/flatlaf-testing/dumps/uidefaults/FlatTestLaf_1.8.0_202.txt +++ b/flatlaf-testing/dumps/uidefaults/FlatTestLaf_1.8.0_202.txt @@ -1390,6 +1390,20 @@ Viewport.foreground #ff0000 HSL 0 100 50 javax.swing.plaf.Colo ViewportUI com.formdev.flatlaf.ui.FlatViewportUI +#---- [style] ---- + +[style].h00 font: $h00.font +[style].h0 font: $h0.font +[style].h1 font: $h1.font +[style].h2 font: $h2.font +[style].h3 font: $h3.font +[style].h4 font: $h4.font +[style].large font: $large.font +[style].medium font: $medium.font +[style].mini font: $mini.font +[style].small font: $small.font + + #---- ---- activeCaption #99b4d1 HSL 211 38 71 javax.swing.plaf.ColorUIResource [UI] @@ -1405,6 +1419,36 @@ defaultFont Segoe UI plain 12 javax.swing.plaf.FontUIResou desktop #ffffff HSL 0 0 100 javax.swing.plaf.ColorUIResource [UI] +#---- h0 ---- + +h0.font [active] Segoe UI plain 30 javax.swing.plaf.FontUIResource [UI] + + +#---- h00 ---- + +h00.font [active] Segoe UI plain 36 javax.swing.plaf.FontUIResource [UI] + + +#---- h1 ---- + +h1.font [active] Segoe UI plain 24 javax.swing.plaf.FontUIResource [UI] + + +#---- h2 ---- + +h2.font [active] Segoe UI plain 18 javax.swing.plaf.FontUIResource [UI] + + +#---- h3 ---- + +h3.font [active] Segoe UI plain 15 javax.swing.plaf.FontUIResource [UI] + + +#---- h4 ---- + +h4.font [active] Segoe UI bold 12 javax.swing.plaf.FontUIResource [UI] + + #---- html ---- html.missingImage [lazy] 38,38 sun.swing.ImageIconUIResource [UI] (sun.awt.image.ToolkitImage) @@ -1426,13 +1470,37 @@ laf.dark false laf.scaleFactor [active] 1.0 +#---- large ---- + +large.font [active] Segoe UI plain 14 javax.swing.plaf.FontUIResource [UI] + + +#---- medium ---- + +medium.font [active] Segoe UI plain 11 javax.swing.plaf.FontUIResource [UI] + + #---- ---- menu #ccffcc HSL 120 100 90 javax.swing.plaf.ColorUIResource [UI] menuText #ff0000 HSL 0 100 50 javax.swing.plaf.ColorUIResource [UI] + + +#---- mini ---- + +mini.font [active] Segoe UI plain 9 javax.swing.plaf.FontUIResource [UI] + + +#---- ---- + scrollbar #88ff88 HSL 120 100 77 javax.swing.plaf.ColorUIResource [UI] +#---- small ---- + +small.font [active] Segoe UI plain 10 javax.swing.plaf.FontUIResource [UI] + + #---- swingx/TaskPane ---- swingx/TaskPaneUI com.formdev.flatlaf.swingx.ui.FlatTaskPaneUI diff --git a/flatlaf-theme-editor/src/main/resources/com/formdev/flatlaf/themeeditor/FlatLafUIKeys.txt b/flatlaf-theme-editor/src/main/resources/com/formdev/flatlaf/themeeditor/FlatLafUIKeys.txt index 48b8477b..1c97a0bc 100644 --- a/flatlaf-theme-editor/src/main/resources/com/formdev/flatlaf/themeeditor/FlatLafUIKeys.txt +++ b/flatlaf-theme-editor/src/main/resources/com/formdev/flatlaf/themeeditor/FlatLafUIKeys.txt @@ -1064,6 +1064,16 @@ Viewport.background Viewport.font Viewport.foreground ViewportUI +[style].h0 +[style].h00 +[style].h1 +[style].h2 +[style].h3 +[style].h4 +[style].large +[style].medium +[style].mini +[style].small activeCaption activeCaptionBorder activeCaptionText @@ -1075,6 +1085,12 @@ controlShadow controlText defaultFont desktop +h0.font +h00.font +h1.font +h2.font +h3.font +h4.font html.missingImage html.pendingImage inactiveCaption @@ -1084,9 +1100,13 @@ info infoText laf.dark laf.scaleFactor +large.font +medium.font menu menuText +mini.font scrollbar +small.font swingx/TaskPaneUI text textHighlight From 6715f01b8c0217d35f19068705775aa6f349be9a Mon Sep 17 00:00:00 2001 From: Karl Tauber Date: Wed, 13 Oct 2021 11:48:28 +0200 Subject: [PATCH 02/22] Typography: use typography styles in demo, theme editor, etc --- .../com/formdev/flatlaf/demo/DemoFrame.java | 5 +- .../com/formdev/flatlaf/demo/TabsPanel.java | 72 +++++++++--------- .../com/formdev/flatlaf/demo/TabsPanel.jfd | 76 +++++++++---------- .../testing/FlatComponentStateTest.java | 10 +-- .../testing/FlatComponentStateTest.jfd | 10 +-- .../themeeditor/FlatThemeFileEditor.java | 5 +- .../flatlaf/themeeditor/FlatThemePreview.java | 4 +- .../flatlaf/themeeditor/FlatThemePreview.jfd | 4 +- .../themeeditor/FlatThemePreviewAll.java | 2 +- .../themeeditor/FlatThemePreviewAll.jfd | 2 +- .../themeeditor/FlatThemePreviewButtons.java | 34 ++++----- .../themeeditor/FlatThemePreviewButtons.jfd | 34 ++++----- .../themeeditor/FlatThemePreviewSwitches.java | 20 ++--- .../themeeditor/FlatThemePreviewSwitches.jfd | 20 ++--- 14 files changed, 148 insertions(+), 150 deletions(-) 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" } ) From e60e3b9faec159eb577c5e26fa363ab76527e8c5 Mon Sep 17 00:00:00 2001 From: Karl Tauber Date: Wed, 13 Oct 2021 13:46:43 +0200 Subject: [PATCH 03/22] Typography: added monospaced font/style --- .../main/resources/com/formdev/flatlaf/FlatLaf.properties | 7 +++++++ flatlaf-testing/dumps/uidefaults/FlatDarkLaf_1.8.0_202.txt | 6 ++++++ .../dumps/uidefaults/FlatLightLaf_1.8.0_202.txt | 6 ++++++ flatlaf-testing/dumps/uidefaults/FlatTestLaf_1.8.0_202.txt | 6 ++++++ .../com/formdev/flatlaf/themeeditor/FlatLafUIKeys.txt | 2 ++ 5 files changed, 27 insertions(+) diff --git a/flatlaf-core/src/main/resources/com/formdev/flatlaf/FlatLaf.properties b/flatlaf-core/src/main/resources/com/formdev/flatlaf/FlatLaf.properties index 83cbfaf2..b483ead4 100644 --- a/flatlaf-core/src/main/resources/com/formdev/flatlaf/FlatLaf.properties +++ b/flatlaf-core/src/main/resources/com/formdev/flatlaf/FlatLaf.properties @@ -45,6 +45,12 @@ mini.font = -3 # default font #defaultFont = ... +# monospaced +[win]monospaced.font = Consolas, "Courier New", Monospaced +[mac]monospaced.font = Menlo, Monospaced +[linux]monospaced.font = "Liberation Mono", "Ubuntu Mono", Monospaced +monospaced.font = Monospaced + # styles [style].h00 = font: $h00.font [style].h0 = font: $h0.font @@ -56,6 +62,7 @@ mini.font = -3 [style].medium = font: $medium.font [style].small = font: $small.font [style].mini = font: $mini.font +[style].monospaced = font: $monospaced.font #---- UI delegates ---- diff --git a/flatlaf-testing/dumps/uidefaults/FlatDarkLaf_1.8.0_202.txt b/flatlaf-testing/dumps/uidefaults/FlatDarkLaf_1.8.0_202.txt index c939baba..fb98341a 100644 --- a/flatlaf-testing/dumps/uidefaults/FlatDarkLaf_1.8.0_202.txt +++ b/flatlaf-testing/dumps/uidefaults/FlatDarkLaf_1.8.0_202.txt @@ -1392,6 +1392,7 @@ ViewportUI com.formdev.flatlaf.ui.FlatViewportUI [style].large font: $large.font [style].medium font: $medium.font [style].mini font: $mini.font +[style].monospaced font: $monospaced.font [style].small font: $small.font @@ -1482,6 +1483,11 @@ menuText #bbbbbb HSL 0 0 73 javax.swing.plaf.Colo mini.font [active] Segoe UI plain 9 javax.swing.plaf.FontUIResource [UI] +#---- monospaced ---- + +monospaced.font [active] Consolas plain 12 javax.swing.plaf.FontUIResource [UI] + + #---- ---- scrollbar #3e4244 HSL 200 5 25 com.formdev.flatlaf.util.DerivedColor [UI] lighten(1%) diff --git a/flatlaf-testing/dumps/uidefaults/FlatLightLaf_1.8.0_202.txt b/flatlaf-testing/dumps/uidefaults/FlatLightLaf_1.8.0_202.txt index 5fe0564b..4e136ebd 100644 --- a/flatlaf-testing/dumps/uidefaults/FlatLightLaf_1.8.0_202.txt +++ b/flatlaf-testing/dumps/uidefaults/FlatLightLaf_1.8.0_202.txt @@ -1397,6 +1397,7 @@ ViewportUI com.formdev.flatlaf.ui.FlatViewportUI [style].large font: $large.font [style].medium font: $medium.font [style].mini font: $mini.font +[style].monospaced font: $monospaced.font [style].small font: $small.font @@ -1487,6 +1488,11 @@ menuText #000000 HSL 0 0 0 javax.swing.plaf.Colo mini.font [active] Segoe UI plain 9 javax.swing.plaf.FontUIResource [UI] +#---- monospaced ---- + +monospaced.font [active] Consolas plain 12 javax.swing.plaf.FontUIResource [UI] + + #---- ---- scrollbar #f5f5f5 HSL 0 0 96 com.formdev.flatlaf.util.DerivedColor [UI] lighten(1%) diff --git a/flatlaf-testing/dumps/uidefaults/FlatTestLaf_1.8.0_202.txt b/flatlaf-testing/dumps/uidefaults/FlatTestLaf_1.8.0_202.txt index 4428984e..7638a905 100644 --- a/flatlaf-testing/dumps/uidefaults/FlatTestLaf_1.8.0_202.txt +++ b/flatlaf-testing/dumps/uidefaults/FlatTestLaf_1.8.0_202.txt @@ -1401,6 +1401,7 @@ ViewportUI com.formdev.flatlaf.ui.FlatViewportUI [style].large font: $large.font [style].medium font: $medium.font [style].mini font: $mini.font +[style].monospaced font: $monospaced.font [style].small font: $small.font @@ -1491,6 +1492,11 @@ menuText #ff0000 HSL 0 100 50 javax.swing.plaf.Colo mini.font [active] Segoe UI plain 9 javax.swing.plaf.FontUIResource [UI] +#---- monospaced ---- + +monospaced.font [active] Consolas plain 12 javax.swing.plaf.FontUIResource [UI] + + #---- ---- scrollbar #88ff88 HSL 120 100 77 javax.swing.plaf.ColorUIResource [UI] diff --git a/flatlaf-theme-editor/src/main/resources/com/formdev/flatlaf/themeeditor/FlatLafUIKeys.txt b/flatlaf-theme-editor/src/main/resources/com/formdev/flatlaf/themeeditor/FlatLafUIKeys.txt index 1c97a0bc..ea68ec20 100644 --- a/flatlaf-theme-editor/src/main/resources/com/formdev/flatlaf/themeeditor/FlatLafUIKeys.txt +++ b/flatlaf-theme-editor/src/main/resources/com/formdev/flatlaf/themeeditor/FlatLafUIKeys.txt @@ -1073,6 +1073,7 @@ ViewportUI [style].large [style].medium [style].mini +[style].monospaced [style].small activeCaption activeCaptionBorder @@ -1105,6 +1106,7 @@ medium.font menu menuText mini.font +monospaced.font scrollbar small.font swingx/TaskPaneUI From d8a0a015e477bbba9309d8c99d68f48b873ab5b2 Mon Sep 17 00:00:00 2001 From: Karl Tauber Date: Wed, 13 Oct 2021 13:48:03 +0200 Subject: [PATCH 04/22] Typography: Extras: add `labelType` property to `FlatLabel` --- .../flatlaf/extras/components/FlatLabel.java | 21 ++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/flatlaf-extras/src/main/java/com/formdev/flatlaf/extras/components/FlatLabel.java b/flatlaf-extras/src/main/java/com/formdev/flatlaf/extras/components/FlatLabel.java index 2577b9a4..ce387bee 100644 --- a/flatlaf-extras/src/main/java/com/formdev/flatlaf/extras/components/FlatLabel.java +++ b/flatlaf-extras/src/main/java/com/formdev/flatlaf/extras/components/FlatLabel.java @@ -16,6 +16,7 @@ package com.formdev.flatlaf.extras.components; +import static com.formdev.flatlaf.FlatClientProperties.STYLE_CLASS; import javax.swing.JLabel; /** @@ -26,6 +27,24 @@ import javax.swing.JLabel; */ public class FlatLabel extends JLabel - implements FlatStyleableComponent + implements FlatComponentExtension, FlatStyleableComponent { + // NOTE: enum names must be equal to typography/font styles + public enum LabelType { h00, h0, h1, h2, h3, h4, large, regular, medium, small, mini, monospaced } + + /** + * Returns type of the label. + */ + public LabelType getLabelType() { + return getClientPropertyEnumString( STYLE_CLASS, LabelType.class, null, LabelType.regular ); + } + + /** + * Specifies type of the label. + */ + public void setLabelType( LabelType labelType ) { + if( labelType == LabelType.regular ) + labelType = null; + putClientPropertyEnumString( STYLE_CLASS, labelType ); + } } From 892b9a732e744ebc2803334b9e62c7bff747f305 Mon Sep 17 00:00:00 2001 From: Karl Tauber Date: Wed, 13 Oct 2021 13:50:41 +0200 Subject: [PATCH 05/22] Typography: added typography/fonts to demo --- .../flatlaf/demo/BasicComponentsPanel.java | 77 +++++++++++++++ .../flatlaf/demo/BasicComponentsPanel.jfd | 95 ++++++++++++++++++- 2 files changed, 169 insertions(+), 3 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 2d9c57d2..1acbc5d7 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 @@ -130,6 +130,19 @@ class BasicComponentsPanel JTextField leadingIconTextField = new JTextField(); JTextField trailingIconTextField = new JTextField(); JTextField iconsTextField = new JTextField(); + JLabel fontsLabel = new JLabel(); + JLabel h00Label = new JLabel(); + JLabel h0Label = new JLabel(); + JLabel h1Label = new JLabel(); + JLabel h2Label = new JLabel(); + JLabel h3Label = new JLabel(); + JLabel h4Label = new JLabel(); + JLabel largeLabel = new JLabel(); + JLabel defaultLabel = new JLabel(); + JLabel mediumLabel = new JLabel(); + JLabel smallLabel = new JLabel(); + JLabel miniLabel = new JLabel(); + JLabel monospacedLabel = new JLabel(); JPopupMenu popupMenu1 = new JPopupMenu(); JMenuItem cutMenuItem = new JMenuItem(); JMenuItem copyMenuItem = new JMenuItem(); @@ -160,6 +173,7 @@ class BasicComponentsPanel "[]para" + "[]" + "[]" + + "[]" + "[]")); //---- labelLabel ---- @@ -667,6 +681,69 @@ class BasicComponentsPanel iconsTextField.setText("text"); add(iconsTextField, "cell 3 14,growx"); + //---- fontsLabel ---- + fontsLabel.setText("Typography / Fonts:"); + add(fontsLabel, "cell 0 15"); + + //---- h00Label ---- + h00Label.setText("H00"); + h00Label.putClientProperty("FlatLaf.styleClass", "h00"); + add(h00Label, "cell 1 15 5 1"); + + //---- h0Label ---- + h0Label.setText("H0"); + h0Label.putClientProperty("FlatLaf.styleClass", "h0"); + add(h0Label, "cell 1 15 5 1"); + + //---- h1Label ---- + h1Label.setText("H1"); + h1Label.putClientProperty("FlatLaf.styleClass", "h1"); + add(h1Label, "cell 1 15 5 1"); + + //---- h2Label ---- + h2Label.setText("H2"); + h2Label.putClientProperty("FlatLaf.styleClass", "h2"); + add(h2Label, "cell 1 15 5 1"); + + //---- h3Label ---- + h3Label.setText("H3"); + h3Label.putClientProperty("FlatLaf.styleClass", "h3"); + add(h3Label, "cell 1 15 5 1"); + + //---- h4Label ---- + h4Label.setText("H4"); + h4Label.putClientProperty("FlatLaf.styleClass", "h4"); + add(h4Label, "cell 1 15 5 1"); + + //---- largeLabel ---- + largeLabel.setText("large"); + largeLabel.putClientProperty("FlatLaf.styleClass", "large"); + add(largeLabel, "cell 1 15 5 1,gapx 30"); + + //---- defaultLabel ---- + defaultLabel.setText("default/regular"); + add(defaultLabel, "cell 1 15 5 1"); + + //---- mediumLabel ---- + mediumLabel.setText("medium"); + mediumLabel.putClientProperty("FlatLaf.styleClass", "medium"); + add(mediumLabel, "cell 1 15 5 1"); + + //---- smallLabel ---- + smallLabel.setText("small"); + smallLabel.putClientProperty("FlatLaf.styleClass", "small"); + add(smallLabel, "cell 1 15 5 1"); + + //---- miniLabel ---- + miniLabel.setText("mini"); + miniLabel.putClientProperty("FlatLaf.styleClass", "mini"); + add(miniLabel, "cell 1 15 5 1"); + + //---- monospacedLabel ---- + monospacedLabel.setText("monospaced"); + monospacedLabel.putClientProperty("FlatLaf.styleClass", "monospaced"); + add(monospacedLabel, "cell 1 15 5 1,gapx 30"); + //======== popupMenu1 ======== { diff --git a/flatlaf-demo/src/main/java/com/formdev/flatlaf/demo/BasicComponentsPanel.jfd b/flatlaf-demo/src/main/java/com/formdev/flatlaf/demo/BasicComponentsPanel.jfd index 53d6e8aa..6c573a57 100644 --- a/flatlaf-demo/src/main/java/com/formdev/flatlaf/demo/BasicComponentsPanel.jfd +++ b/flatlaf-demo/src/main/java/com/formdev/flatlaf/demo/BasicComponentsPanel.jfd @@ -9,7 +9,7 @@ new FormModel { add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) { "$layoutConstraints": "insets dialog,hidemode 3" "$columnConstraints": "[][sizegroup 1][sizegroup 1][sizegroup 1][][]" - "$rowConstraints": "[][][][][][][][][][][][]para[][][]" + "$rowConstraints": "[][][][][][][][][][][][]para[][][][]" } ) { name: "this" add( new FormComponent( "javax.swing.JLabel" ) { @@ -671,9 +671,98 @@ new FormModel { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { "value": "cell 3 14,growx" } ) + add( new FormComponent( "javax.swing.JLabel" ) { + name: "fontsLabel" + "text": "Typography / Fonts:" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 0 15" + } ) + add( new FormComponent( "javax.swing.JLabel" ) { + name: "h00Label" + "text": "H00" + "$client.FlatLaf.styleClass": "h00" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 1 15 5 1" + } ) + add( new FormComponent( "javax.swing.JLabel" ) { + name: "h0Label" + "text": "H0" + "$client.FlatLaf.styleClass": "h0" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 1 15 5 1" + } ) + add( new FormComponent( "javax.swing.JLabel" ) { + name: "h1Label" + "text": "H1" + "$client.FlatLaf.styleClass": "h1" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 1 15 5 1" + } ) + add( new FormComponent( "javax.swing.JLabel" ) { + name: "h2Label" + "text": "H2" + "$client.FlatLaf.styleClass": "h2" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 1 15 5 1" + } ) + add( new FormComponent( "javax.swing.JLabel" ) { + name: "h3Label" + "text": "H3" + "$client.FlatLaf.styleClass": "h3" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 1 15 5 1" + } ) + add( new FormComponent( "javax.swing.JLabel" ) { + name: "h4Label" + "text": "H4" + "$client.FlatLaf.styleClass": "h4" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 1 15 5 1" + } ) + add( new FormComponent( "javax.swing.JLabel" ) { + name: "largeLabel" + "text": "large" + "$client.FlatLaf.styleClass": "large" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 1 15 5 1,gapx 30" + } ) + add( new FormComponent( "javax.swing.JLabel" ) { + name: "defaultLabel" + "text": "default/regular" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 1 15 5 1" + } ) + add( new FormComponent( "javax.swing.JLabel" ) { + name: "mediumLabel" + "text": "medium" + "$client.FlatLaf.styleClass": "medium" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 1 15 5 1" + } ) + add( new FormComponent( "javax.swing.JLabel" ) { + name: "smallLabel" + "text": "small" + "$client.FlatLaf.styleClass": "small" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 1 15 5 1" + } ) + add( new FormComponent( "javax.swing.JLabel" ) { + name: "miniLabel" + "text": "mini" + "$client.FlatLaf.styleClass": "mini" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 1 15 5 1" + } ) + add( new FormComponent( "javax.swing.JLabel" ) { + name: "monospacedLabel" + "text": "monospaced" + "$client.FlatLaf.styleClass": "monospaced" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 1 15 5 1,gapx 30" + } ) }, new FormLayoutConstraints( null ) { "location": new java.awt.Point( 0, 0 ) - "size": new java.awt.Dimension( 920, 480 ) + "size": new java.awt.Dimension( 920, 550 ) } ) add( new FormContainer( "javax.swing.JPopupMenu", new FormLayoutManager( class javax.swing.JPopupMenu ) ) { name: "popupMenu1" @@ -693,7 +782,7 @@ new FormModel { "mnemonic": 80 } ) }, new FormLayoutConstraints( null ) { - "location": new java.awt.Point( 0, 500 ) + "location": new java.awt.Point( 0, 570 ) "size": new java.awt.Dimension( 91, 87 ) } ) } From 80235d53f42b72326c142629503bf9e3b6aed041 Mon Sep 17 00:00:00 2001 From: Karl Tauber Date: Wed, 13 Oct 2021 14:29:57 +0200 Subject: [PATCH 06/22] Typography: added FlatTypographyTest, which was used to compare various typography systems --- .../flatlaf/testing/FlatTypographyTest.java | 974 ++++++++++++++++++ .../flatlaf/testing/FlatTypographyTest.jfd | 897 ++++++++++++++++ 2 files changed, 1871 insertions(+) create mode 100644 flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatTypographyTest.java create mode 100644 flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatTypographyTest.jfd 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 new file mode 100644 index 00000000..055f642e --- /dev/null +++ b/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatTypographyTest.java @@ -0,0 +1,974 @@ +/* +/* + * Copyright 2021 FormDev Software GmbH + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.formdev.flatlaf.testing; + +import java.awt.*; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; +import java.io.IOException; +import java.net.URI; +import java.net.URISyntaxException; +import javax.swing.*; +import net.miginfocom.swing.*; + +/** + * @author Karl Tauber + */ +public class FlatTypographyTest + extends FlatTestPanel +{ + public static void main( String[] args ) { + SwingUtilities.invokeLater( () -> { + FlatTestFrame frame = FlatTestFrame.create( args, "FlatTypographyTest" ); + frame.showFrame( FlatTypographyTest::new ); + } ); + } + + public FlatTypographyTest() { + initComponents(); + } + + private void initComponents() { + // JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents + JLabel label54 = new JLabel(); + JLabel label68 = new JLabel(); + JLabel label69 = new JLabel(); + JLabel label10 = new JLabel(); + JLabel label11 = new JLabel(); + JLabel label72 = new JLabel(); + JLabel label28 = new JLabel(); + JLabel label1 = new JLabel(); + JLabel label37 = new JLabel(); + JLabel label46 = new JLabel(); + FlatTypographyTest.LinkLabel linkLabel9 = new FlatTypographyTest.LinkLabel(); + FlatTypographyTest.LinkLabel linkLabel1 = new FlatTypographyTest.LinkLabel(); + FlatTypographyTest.LinkLabel linkLabel2 = new FlatTypographyTest.LinkLabel(); + FlatTypographyTest.LinkLabel linkLabel3 = new FlatTypographyTest.LinkLabel(); + JLabel label2 = new JLabel(); + FlatTypographyTest.LinkLabel linkLabel4 = new FlatTypographyTest.LinkLabel(); + FlatTypographyTest.LinkLabel linkLabel10 = new FlatTypographyTest.LinkLabel(); + FlatTypographyTest.LinkLabel linkLabel8 = new FlatTypographyTest.LinkLabel(); + FlatTypographyTest.LinkLabel linkLabel5 = new FlatTypographyTest.LinkLabel(); + FlatTypographyTest.LinkLabel linkLabel6 = new FlatTypographyTest.LinkLabel(); + FlatTypographyTest.LinkLabel linkLabel7 = new FlatTypographyTest.LinkLabel(); + FlatTypographyTest.FontPreview fontPreview69 = new FlatTypographyTest.FontPreview(); + FlatTypographyTest.FontPreview fontPreview93 = new FlatTypographyTest.FontPreview(); + FlatTypographyTest.FontPreview fontPreview40 = new FlatTypographyTest.FontPreview(); + FlatTypographyTest.FontPreview fontPreview85 = new FlatTypographyTest.FontPreview(); + FlatTypographyTest.FontPreview fontPreview70 = new FlatTypographyTest.FontPreview(); + FlatTypographyTest.FontPreview fontPreview51 = new FlatTypographyTest.FontPreview(); + FlatTypographyTest.FontPreview fontPreview1 = new FlatTypographyTest.FontPreview(); + FlatTypographyTest.FontPreview fontPreview11 = new FlatTypographyTest.FontPreview(); + FlatTypographyTest.FontPreview fontPreview19 = new FlatTypographyTest.FontPreview(); + FlatTypographyTest.FontPreview fontPreview27 = new FlatTypographyTest.FontPreview(); + FlatTypographyTest.FontPreview fontPreview41 = new FlatTypographyTest.FontPreview(); + FlatTypographyTest.FontPreview fontPreview86 = new FlatTypographyTest.FontPreview(); + FlatTypographyTest.FontPreview fontPreview71 = new FlatTypographyTest.FontPreview(); + FlatTypographyTest.FontPreview fontPreview47 = new FlatTypographyTest.FontPreview(); + FlatTypographyTest.FontPreview fontPreview54 = new FlatTypographyTest.FontPreview(); + FlatTypographyTest.FontPreview fontPreview62 = new FlatTypographyTest.FontPreview(); + JSeparator separator3 = new JSeparator(); + FlatTypographyTest.FontPreview fontPreview2 = new FlatTypographyTest.FontPreview(); + FlatTypographyTest.FontPreview fontPreview12 = new FlatTypographyTest.FontPreview(); + FlatTypographyTest.FontPreview fontPreview20 = new FlatTypographyTest.FontPreview(); + FlatTypographyTest.FontPreview fontPreview28 = new FlatTypographyTest.FontPreview(); + FlatTypographyTest.FontPreview fontPreview42 = new FlatTypographyTest.FontPreview(); + FlatTypographyTest.FontPreview fontPreview87 = new FlatTypographyTest.FontPreview(); + FlatTypographyTest.FontPreview fontPreview72 = new FlatTypographyTest.FontPreview(); + FlatTypographyTest.FontPreview fontPreview48 = new FlatTypographyTest.FontPreview(); + FlatTypographyTest.FontPreview fontPreview55 = new FlatTypographyTest.FontPreview(); + FlatTypographyTest.FontPreview fontPreview63 = new FlatTypographyTest.FontPreview(); + FlatTypographyTest.FontPreview fontPreview3 = new FlatTypographyTest.FontPreview(); + FlatTypographyTest.FontPreview fontPreview13 = new FlatTypographyTest.FontPreview(); + FlatTypographyTest.FontPreview fontPreview21 = new FlatTypographyTest.FontPreview(); + FlatTypographyTest.FontPreview fontPreview29 = new FlatTypographyTest.FontPreview(); + FlatTypographyTest.FontPreview fontPreview43 = new FlatTypographyTest.FontPreview(); + FlatTypographyTest.FontPreview fontPreview88 = new FlatTypographyTest.FontPreview(); + FlatTypographyTest.FontPreview fontPreview73 = new FlatTypographyTest.FontPreview(); + FlatTypographyTest.FontPreview fontPreview49 = new FlatTypographyTest.FontPreview(); + FlatTypographyTest.FontPreview fontPreview57 = new FlatTypographyTest.FontPreview(); + FlatTypographyTest.FontPreview fontPreview64 = new FlatTypographyTest.FontPreview(); + FlatTypographyTest.FontPreview fontPreview4 = new FlatTypographyTest.FontPreview(); + FlatTypographyTest.FontPreview fontPreview14 = new FlatTypographyTest.FontPreview(); + FlatTypographyTest.FontPreview fontPreview22 = new FlatTypographyTest.FontPreview(); + FlatTypographyTest.FontPreview fontPreview30 = new FlatTypographyTest.FontPreview(); + FlatTypographyTest.FontPreview fontPreview89 = new FlatTypographyTest.FontPreview(); + FlatTypographyTest.FontPreview fontPreview74 = new FlatTypographyTest.FontPreview(); + FlatTypographyTest.FontPreview fontPreview50 = new FlatTypographyTest.FontPreview(); + FlatTypographyTest.FontPreview fontPreview58 = new FlatTypographyTest.FontPreview(); + FlatTypographyTest.FontPreview fontPreview65 = new FlatTypographyTest.FontPreview(); + FlatTypographyTest.FontPreview fontPreview5 = new FlatTypographyTest.FontPreview(); + FlatTypographyTest.FontPreview fontPreview15 = new FlatTypographyTest.FontPreview(); + FlatTypographyTest.FontPreview fontPreview23 = new FlatTypographyTest.FontPreview(); + FlatTypographyTest.FontPreview fontPreview31 = new FlatTypographyTest.FontPreview(); + FlatTypographyTest.FontPreview fontPreview44 = new FlatTypographyTest.FontPreview(); + FlatTypographyTest.FontPreview fontPreview56 = new FlatTypographyTest.FontPreview(); + FlatTypographyTest.FontPreview fontPreview66 = new FlatTypographyTest.FontPreview(); + JSeparator separator1 = new JSeparator(); + FlatTypographyTest.FontPreview fontPreview7 = new FlatTypographyTest.FontPreview(); + FlatTypographyTest.FontPreview fontPreview6 = new FlatTypographyTest.FontPreview(); + FlatTypographyTest.FontPreview fontPreview16 = new FlatTypographyTest.FontPreview(); + FlatTypographyTest.FontPreview fontPreview24 = new FlatTypographyTest.FontPreview(); + FlatTypographyTest.FontPreview fontPreview32 = new FlatTypographyTest.FontPreview(); + FlatTypographyTest.FontPreview fontPreview45 = new FlatTypographyTest.FontPreview(); + FlatTypographyTest.FontPreview fontPreview90 = new FlatTypographyTest.FontPreview(); + FlatTypographyTest.FontPreview fontPreview75 = new FlatTypographyTest.FontPreview(); + FlatTypographyTest.FontPreview fontPreview52 = new FlatTypographyTest.FontPreview(); + FlatTypographyTest.FontPreview fontPreview59 = new FlatTypographyTest.FontPreview(); + FlatTypographyTest.FontPreview fontPreview67 = new FlatTypographyTest.FontPreview(); + JSeparator separator2 = new JSeparator(); + FlatTypographyTest.FontPreview fontPreview8 = new FlatTypographyTest.FontPreview(); + FlatTypographyTest.FontPreview fontPreview17 = new FlatTypographyTest.FontPreview(); + FlatTypographyTest.FontPreview fontPreview25 = new FlatTypographyTest.FontPreview(); + FlatTypographyTest.FontPreview fontPreview39 = new FlatTypographyTest.FontPreview(); + FlatTypographyTest.FontPreview fontPreview91 = new FlatTypographyTest.FontPreview(); + FlatTypographyTest.FontPreview fontPreview76 = new FlatTypographyTest.FontPreview(); + FlatTypographyTest.FontPreview fontPreview9 = new FlatTypographyTest.FontPreview(); + FlatTypographyTest.FontPreview fontPreview18 = new FlatTypographyTest.FontPreview(); + FlatTypographyTest.FontPreview fontPreview26 = new FlatTypographyTest.FontPreview(); + FlatTypographyTest.FontPreview fontPreview33 = new FlatTypographyTest.FontPreview(); + FlatTypographyTest.FontPreview fontPreview46 = new FlatTypographyTest.FontPreview(); + FlatTypographyTest.FontPreview fontPreview92 = new FlatTypographyTest.FontPreview(); + FlatTypographyTest.FontPreview fontPreview77 = new FlatTypographyTest.FontPreview(); + FlatTypographyTest.FontPreview fontPreview53 = new FlatTypographyTest.FontPreview(); + FlatTypographyTest.FontPreview fontPreview60 = new FlatTypographyTest.FontPreview(); + FlatTypographyTest.FontPreview fontPreview68 = new FlatTypographyTest.FontPreview(); + FlatTypographyTest.FontPreview fontPreview10 = new FlatTypographyTest.FontPreview(); + FlatTypographyTest.FontPreview fontPreview34 = new FlatTypographyTest.FontPreview(); + FlatTypographyTest.FontPreview fontPreview78 = new FlatTypographyTest.FontPreview(); + FlatTypographyTest.FontPreview fontPreview61 = new FlatTypographyTest.FontPreview(); + + //======== this ======== + setLayout(new MigLayout( + "ltr,insets dialog,hidemode 3", + // columns + "[left]unrel" + + "[left]unrel" + + "[left]unrel" + + "[left]unrel" + + "[left]unrel" + + "[left]unrel" + + "[left]unrel" + + "[left]unrel" + + "[left]unrel" + + "[left]unrel", + // rows + "[top]" + + "[bottom]" + + "[bottom]" + + "[bottom]" + + "[bottom]" + + "[]" + + "[bottom]" + + "[bottom]" + + "[bottom]" + + "[bottom]" + + "[]" + + "[bottom]" + + "[]" + + "[bottom]" + + "[bottom]" + + "[bottom]")); + + //---- label54 ---- + label54.setText("FlatLaf
Windows"); + label54.putClientProperty("FlatLaf.styleClass", "h1"); + add(label54, "cell 0 0"); + + //---- label68 ---- + label68.setText("JetBrains
Windows"); + label68.putClientProperty("FlatLaf.styleClass", "h1"); + add(label68, "cell 1 0"); + + //---- label69 ---- + label69.setText("JetBrains
macOS"); + label69.putClientProperty("FlatLaf.styleClass", "h1"); + add(label69, "cell 2 0"); + + //---- label10 ---- + label10.setText("macOS"); + label10.putClientProperty("FlatLaf.styleClass", "h1"); + add(label10, "cell 3 0"); + + //---- label11 ---- + label11.setText("Windows 10/11"); + label11.putClientProperty("FlatLaf.styleClass", "h1"); + add(label11, "cell 4 0"); + + //---- label72 ---- + label72.setText("GitHub
Primer"); + label72.putClientProperty("FlatLaf.styleClass", "h1"); + add(label72, "cell 5 0"); + + //---- label28 ---- + label28.setText("Material"); + label28.putClientProperty("FlatLaf.styleClass", "h1"); + add(label28, "cell 6 0"); + + //---- label1 ---- + label1.setText("SAP Fiori"); + label1.putClientProperty("FlatLaf.styleClass", "h1"); + add(label1, "cell 7 0"); + + //---- label37 ---- + label37.setText("Atlassian"); + label37.putClientProperty("FlatLaf.styleClass", "h1"); + add(label37, "cell 8 0"); + + //---- label46 ---- + label46.setText("Iris"); + label46.putClientProperty("FlatLaf.styleClass", "h1"); + add(label46, "cell 9 0"); + + //---- linkLabel9 ---- + linkLabel9.setLink("https://www.formdev.com/flatlaf/typography/"); + add(linkLabel9, "cell 0 1"); + + //---- linkLabel1 ---- + linkLabel1.setLink("https://jetbrains.design/intellij/principles/typography/"); + add(linkLabel1, "cell 1 1"); + + //---- linkLabel2 ---- + linkLabel2.setLink("https://developer.apple.com/design/human-interface-guidelines/macos/visual-design/typography/"); + add(linkLabel2, "cell 3 1"); + + //---- linkLabel3 ---- + linkLabel3.setLink("https://docs.microsoft.com/en-us/windows/apps/design/style/typography#type-ramp"); + add(linkLabel3, "cell 4 1"); + + //---- label2 ---- + label2.setText("/"); + add(label2, "cell 4 1"); + + //---- linkLabel4 ---- + linkLabel4.setLink("https://docs.microsoft.com/en-us/windows/apps/design/signature-experiences/typography#type-ramp"); + add(linkLabel4, "cell 4 1"); + + //---- linkLabel10 ---- + linkLabel10.setLink("https://primer.style/css/utilities/typography"); + add(linkLabel10, "cell 5 1"); + + //---- linkLabel8 ---- + linkLabel8.setLink("https://material.io/design/typography/the-type-system.html#type-scale"); + add(linkLabel8, "cell 6 1"); + + //---- linkLabel5 ---- + linkLabel5.setLink("https://experience.sap.com/fiori-design-web/typography/#headlines-and-font-styles-for-ui-controls"); + add(linkLabel5, "cell 7 1"); + + //---- linkLabel6 ---- + linkLabel6.setLink("https://atlassian.design/foundations/typography"); + add(linkLabel6, "cell 8 1"); + + //---- linkLabel7 ---- + linkLabel7.setLink("https://iris.alkamitech.com/foundations/typography.html"); + add(linkLabel7, "cell 9 1"); + + //---- fontPreview69 ---- + fontPreview69.setFontType("H1"); + fontPreview69.setFontSize(96); + fontPreview69.setBaseSize(16); + add(fontPreview69, "cell 6 2"); + + //---- fontPreview93 ---- + fontPreview93.setBaseSize(12); + fontPreview93.setFontType("H00"); + fontPreview93.setFontSize(36); + add(fontPreview93, "cell 0 3"); + + //---- fontPreview40 ---- + fontPreview40.setFontSize(68); + fontPreview40.setFontType("Display"); + fontPreview40.setBaseSize(14); + add(fontPreview40, "cell 4 2 1 2"); + + //---- fontPreview85 ---- + fontPreview85.setFontSize(48); + fontPreview85.setFontType("H00"); + fontPreview85.setBaseSize(16); + add(fontPreview85, "cell 5 3"); + + //---- fontPreview70 ---- + fontPreview70.setFontSize(60); + fontPreview70.setFontType("H2"); + fontPreview70.setBaseSize(16); + add(fontPreview70, "cell 6 3"); + + //---- fontPreview51 ---- + fontPreview51.setFontType("h900"); + fontPreview51.setFontSize(35); + fontPreview51.setBaseSize(14); + add(fontPreview51, "cell 8 3"); + + //---- fontPreview1 ---- + fontPreview1.setBaseSize(12); + fontPreview1.setFontType("H0"); + fontPreview1.setFontSize(30); + add(fontPreview1, "cell 0 4"); + + //---- fontPreview11 ---- + fontPreview11.setFontType("H0"); + fontPreview11.setFontSize(24); + fontPreview11.setBold(true); + fontPreview11.setBaseSize(12); + fontPreview11.setShowPlain(true); + add(fontPreview11, "cell 1 4"); + + //---- fontPreview19 ---- + fontPreview19.setFontType("H0"); + fontPreview19.setFontSize(25); + fontPreview19.setBold(true); + fontPreview19.setBaseSize(13); + fontPreview19.setShowPlain(true); + add(fontPreview19, "cell 2 4"); + + //---- fontPreview27 ---- + fontPreview27.setFontType("Large Title"); + fontPreview27.setFontSize(26); + fontPreview27.setBaseSize(13); + add(fontPreview27, "cell 3 4"); + + //---- fontPreview41 ---- + fontPreview41.setFontType("Title Large"); + fontPreview41.setFontSize(40); + fontPreview41.setBaseSize(14); + add(fontPreview41, "cell 4 4"); + + //---- fontPreview86 ---- + fontPreview86.setFontSize(40); + fontPreview86.setFontType("H0"); + fontPreview86.setBaseSize(16); + add(fontPreview86, "cell 5 4"); + + //---- fontPreview71 ---- + fontPreview71.setFontType("H3"); + fontPreview71.setFontSize(48); + fontPreview71.setBaseSize(16); + add(fontPreview71, "cell 6 4"); + + //---- fontPreview47 ---- + fontPreview47.setFontType("Header 1"); + fontPreview47.setFontSize(36); + fontPreview47.setBaseSize(14); + add(fontPreview47, "cell 7 4"); + + //---- fontPreview54 ---- + fontPreview54.setBaseSize(14); + fontPreview54.setFontType("h800"); + fontPreview54.setFontSize(29); + add(fontPreview54, "cell 8 4"); + + //---- fontPreview62 ---- + fontPreview62.setBaseSize(16); + fontPreview62.setFontSize(44); + fontPreview62.setFontType("Hero"); + add(fontPreview62, "cell 9 4"); + add(separator3, "cell 0 5 10 1,growx"); + + //---- fontPreview2 ---- + fontPreview2.setBaseSize(12); + fontPreview2.setFontSize(24); + fontPreview2.setFontType("H1"); + add(fontPreview2, "cell 0 6"); + + //---- fontPreview12 ---- + fontPreview12.setFontType("H1"); + fontPreview12.setFontSize(21); + fontPreview12.setBold(true); + fontPreview12.setBaseSize(12); + fontPreview12.setShowPlain(true); + add(fontPreview12, "cell 1 6"); + + //---- fontPreview20 ---- + fontPreview20.setFontType("H1"); + fontPreview20.setFontSize(22); + fontPreview20.setBold(true); + fontPreview20.setBaseSize(13); + fontPreview20.setShowPlain(true); + add(fontPreview20, "cell 2 6"); + + //---- fontPreview28 ---- + fontPreview28.setFontSize(22); + fontPreview28.setFontType("Title 1"); + fontPreview28.setBaseSize(13); + add(fontPreview28, "cell 3 6"); + + //---- fontPreview42 ---- + fontPreview42.setFontType("Title"); + fontPreview42.setFontSize(28); + fontPreview42.setBaseSize(14); + add(fontPreview42, "cell 4 6"); + + //---- fontPreview87 ---- + fontPreview87.setFontType("H1"); + fontPreview87.setFontSize(32); + fontPreview87.setBaseSize(16); + add(fontPreview87, "cell 5 6"); + + //---- fontPreview72 ---- + fontPreview72.setFontType("H4"); + fontPreview72.setFontSize(34); + fontPreview72.setBaseSize(16); + add(fontPreview72, "cell 6 6"); + + //---- fontPreview48 ---- + fontPreview48.setFontType("Header 2"); + fontPreview48.setFontSize(24); + fontPreview48.setBaseSize(14); + add(fontPreview48, "cell 7 6"); + + //---- fontPreview55 ---- + fontPreview55.setBaseSize(14); + fontPreview55.setFontType("h700"); + fontPreview55.setFontSize(24); + add(fontPreview55, "cell 8 6"); + + //---- fontPreview63 ---- + fontPreview63.setBaseSize(16); + fontPreview63.setFontSize(32); + fontPreview63.setFontType("H1"); + add(fontPreview63, "cell 9 6"); + + //---- fontPreview3 ---- + fontPreview3.setBaseSize(12); + fontPreview3.setFontSize(18); + fontPreview3.setFontType("H2"); + add(fontPreview3, "cell 0 7"); + + //---- fontPreview13 ---- + fontPreview13.setFontType("H2"); + fontPreview13.setFontSize(17); + fontPreview13.setBold(true); + fontPreview13.setBaseSize(12); + fontPreview13.setShowPlain(true); + add(fontPreview13, "cell 1 7"); + + //---- fontPreview21 ---- + fontPreview21.setFontType("H2"); + fontPreview21.setFontSize(18); + fontPreview21.setBold(true); + fontPreview21.setBaseSize(13); + fontPreview21.setShowPlain(true); + add(fontPreview21, "cell 2 7"); + + //---- fontPreview29 ---- + fontPreview29.setFontSize(17); + fontPreview29.setFontType("Title 2"); + fontPreview29.setBaseSize(13); + add(fontPreview29, "cell 3 7"); + + //---- fontPreview43 ---- + fontPreview43.setFontType("Subtitle"); + fontPreview43.setFontSize(20); + fontPreview43.setBaseSize(14); + add(fontPreview43, "cell 4 7"); + + //---- fontPreview88 ---- + fontPreview88.setFontSize(24); + fontPreview88.setFontType("H2"); + fontPreview88.setBaseSize(16); + add(fontPreview88, "cell 5 7"); + + //---- fontPreview73 ---- + fontPreview73.setFontType("H5"); + fontPreview73.setFontSize(24); + fontPreview73.setBaseSize(16); + add(fontPreview73, "cell 6 7"); + + //---- fontPreview49 ---- + fontPreview49.setFontType("Header 3"); + fontPreview49.setFontSize(20); + fontPreview49.setBaseSize(14); + add(fontPreview49, "cell 7 7"); + + //---- fontPreview57 ---- + fontPreview57.setBaseSize(14); + fontPreview57.setFontType("h600"); + fontPreview57.setFontSize(20); + add(fontPreview57, "cell 8 7"); + + //---- fontPreview64 ---- + fontPreview64.setBaseSize(16); + fontPreview64.setFontType("H2"); + fontPreview64.setFontSize(24); + add(fontPreview64, "cell 9 7"); + + //---- fontPreview4 ---- + fontPreview4.setBaseSize(12); + fontPreview4.setFontSize(15); + fontPreview4.setFontType("H3"); + add(fontPreview4, "cell 0 8"); + + //---- fontPreview14 ---- + fontPreview14.setFontType("H3"); + fontPreview14.setFontSize(15); + fontPreview14.setBold(true); + fontPreview14.setBaseSize(12); + fontPreview14.setShowPlain(true); + add(fontPreview14, "cell 1 8"); + + //---- fontPreview22 ---- + fontPreview22.setFontType("H3"); + fontPreview22.setFontSize(16); + fontPreview22.setBold(true); + fontPreview22.setBaseSize(13); + fontPreview22.setShowPlain(true); + add(fontPreview22, "cell 2 8"); + + //---- fontPreview30 ---- + fontPreview30.setFontType("Title 3"); + fontPreview30.setFontSize(15); + fontPreview30.setBaseSize(13); + add(fontPreview30, "cell 3 8"); + + //---- fontPreview89 ---- + fontPreview89.setFontType("H3"); + fontPreview89.setFontSize(20); + fontPreview89.setBaseSize(16); + add(fontPreview89, "cell 5 8"); + + //---- fontPreview74 ---- + fontPreview74.setFontType("H6"); + fontPreview74.setFontSize(20); + fontPreview74.setBaseSize(16); + add(fontPreview74, "cell 6 8"); + + //---- fontPreview50 ---- + fontPreview50.setFontType("Header 4"); + fontPreview50.setFontSize(18); + fontPreview50.setBaseSize(14); + add(fontPreview50, "cell 7 8"); + + //---- fontPreview58 ---- + fontPreview58.setBaseSize(14); + fontPreview58.setFontType("h500"); + fontPreview58.setFontSize(16); + add(fontPreview58, "cell 8 8"); + + //---- fontPreview65 ---- + fontPreview65.setBaseSize(16); + fontPreview65.setFontSize(20); + fontPreview65.setFontType("H3"); + add(fontPreview65, "cell 9 8"); + + //---- fontPreview5 ---- + fontPreview5.setBaseSize(12); + fontPreview5.setFontSize(14); + fontPreview5.setFontType("Large"); + add(fontPreview5, "cell 0 9"); + + //---- fontPreview15 ---- + fontPreview15.setFontType("H4"); + fontPreview15.setBold(true); + fontPreview15.setFontSize(12); + fontPreview15.setBaseSize(12); + add(fontPreview15, "cell 1 9"); + + //---- fontPreview23 ---- + fontPreview23.setFontType("H4"); + fontPreview23.setFontSize(13); + fontPreview23.setBold(true); + fontPreview23.setBaseSize(13); + add(fontPreview23, "cell 2 9"); + + //---- fontPreview31 ---- + fontPreview31.setFontType("Headline"); + fontPreview31.setFontSize(13); + fontPreview31.setBold(true); + fontPreview31.setBaseSize(13); + add(fontPreview31, "cell 3 9"); + + //---- fontPreview44 ---- + fontPreview44.setFontSize(18); + fontPreview44.setFontType("Body Large"); + fontPreview44.setBaseSize(14); + add(fontPreview44, "cell 4 9"); + + //---- fontPreview56 ---- + fontPreview56.setFontType("Large Text / Header 5"); + fontPreview56.setFontSize(16); + fontPreview56.setBaseSize(14); + add(fontPreview56, "cell 7 9"); + + //---- fontPreview66 ---- + fontPreview66.setBaseSize(16); + fontPreview66.setFontType("H4"); + fontPreview66.setFontSize(18); + add(fontPreview66, "cell 9 9"); + add(separator1, "cell 0 10 10 1,growx"); + + //---- fontPreview7 ---- + fontPreview7.setFontType("Default"); + fontPreview7.setFontSize(12); + fontPreview7.setBaseSize(12); + add(fontPreview7, "cell 0 11"); + + //---- fontPreview6 ---- + fontPreview6.setFontSize(12); + fontPreview6.setBold(true); + fontPreview6.setFontType("H4"); + fontPreview6.setBaseSize(12); + add(fontPreview6, "cell 0 11"); + + //---- fontPreview16 ---- + fontPreview16.setFontType("Default"); + fontPreview16.setFontSize(12); + fontPreview16.setBaseSize(12); + add(fontPreview16, "cell 1 11"); + + //---- fontPreview24 ---- + fontPreview24.setFontType("Default"); + fontPreview24.setFontSize(13); + fontPreview24.setBaseSize(13); + add(fontPreview24, "cell 2 11"); + + //---- fontPreview32 ---- + fontPreview32.setFontType("Body"); + fontPreview32.setFontSize(13); + fontPreview32.setBaseSize(13); + add(fontPreview32, "cell 3 11"); + + //---- fontPreview45 ---- + fontPreview45.setFontType("Body"); + fontPreview45.setFontSize(14); + fontPreview45.setBaseSize(14); + add(fontPreview45, "cell 4 11"); + + //---- fontPreview90 ---- + fontPreview90.setFontSize(16); + fontPreview90.setFontType("Body / H4"); + fontPreview90.setBaseSize(16); + add(fontPreview90, "cell 5 11"); + + //---- fontPreview75 ---- + fontPreview75.setFontSize(16); + fontPreview75.setFontType("Body 1 / Subtitle 1"); + fontPreview75.setBaseSize(16); + add(fontPreview75, "cell 6 11"); + + //---- fontPreview52 ---- + fontPreview52.setFontType("Medium Text / Header 6"); + fontPreview52.setFontSize(14); + fontPreview52.setBaseSize(14); + add(fontPreview52, "cell 7 11"); + + //---- fontPreview59 ---- + fontPreview59.setBaseSize(14); + fontPreview59.setFontSize(14); + fontPreview59.setFontType("h400"); + add(fontPreview59, "cell 8 11"); + + //---- fontPreview67 ---- + fontPreview67.setBaseSize(16); + fontPreview67.setFontSize(16); + fontPreview67.setFontType("Body"); + add(fontPreview67, "cell 9 11"); + add(separator2, "cell 0 12 10 1,growx"); + + //---- fontPreview8 ---- + fontPreview8.setFontType("Medium"); + fontPreview8.setFontSize(11); + fontPreview8.setBaseSize(12); + add(fontPreview8, "cell 0 13"); + + //---- fontPreview17 ---- + fontPreview17.setFontType("Medium"); + fontPreview17.setFontSize(12); + fontPreview17.setBaseSize(12); + add(fontPreview17, "cell 1 13"); + + //---- fontPreview25 ---- + fontPreview25.setFontType("Medium"); + fontPreview25.setFontSize(12); + fontPreview25.setBaseSize(13); + add(fontPreview25, "cell 2 13"); + + //---- fontPreview39 ---- + fontPreview39.setFontSize(12); + fontPreview39.setFontType("Callout"); + fontPreview39.setBaseSize(13); + add(fontPreview39, "cell 3 13"); + + //---- fontPreview91 ---- + fontPreview91.setFontType("H5"); + fontPreview91.setFontSize(14); + fontPreview91.setBaseSize(16); + add(fontPreview91, "cell 5 13"); + + //---- fontPreview76 ---- + fontPreview76.setFontType("Body 2 / Subtitle 2"); + fontPreview76.setFontSize(14); + fontPreview76.setBaseSize(16); + add(fontPreview76, "cell 6 13"); + + //---- fontPreview9 ---- + fontPreview9.setFontType("Small"); + fontPreview9.setFontSize(10); + fontPreview9.setBaseSize(12); + add(fontPreview9, "cell 0 14"); + + //---- fontPreview18 ---- + fontPreview18.setFontType("Small"); + fontPreview18.setFontSize(12); + fontPreview18.setBaseSize(12); + add(fontPreview18, "cell 1 14"); + + //---- fontPreview26 ---- + fontPreview26.setFontType("Small"); + fontPreview26.setFontSize(11); + fontPreview26.setBaseSize(13); + add(fontPreview26, "cell 2 14"); + + //---- fontPreview33 ---- + fontPreview33.setFontType("Subheadline"); + fontPreview33.setFontSize(11); + fontPreview33.setBaseSize(13); + add(fontPreview33, "cell 3 14"); + + //---- fontPreview46 ---- + fontPreview46.setFontType("Caption"); + fontPreview46.setFontSize(12); + fontPreview46.setBaseSize(14); + add(fontPreview46, "cell 4 14"); + + //---- fontPreview92 ---- + fontPreview92.setFontSize(12); + fontPreview92.setFontType("H6"); + fontPreview92.setBaseSize(12); + add(fontPreview92, "cell 5 14"); + + //---- fontPreview77 ---- + fontPreview77.setFontSize(12); + fontPreview77.setFontType("Caption"); + fontPreview77.setBaseSize(16); + add(fontPreview77, "cell 6 14"); + + //---- fontPreview53 ---- + fontPreview53.setFontType("Small Text"); + fontPreview53.setFontSize(12); + fontPreview53.setBaseSize(14); + add(fontPreview53, "cell 7 14"); + + //---- fontPreview60 ---- + fontPreview60.setBaseSize(14); + fontPreview60.setFontType("h300 / h200"); + fontPreview60.setFontSize(12); + add(fontPreview60, "cell 8 14"); + + //---- fontPreview68 ---- + fontPreview68.setBaseSize(16); + fontPreview68.setFontType("Small"); + fontPreview68.setFontSize(14); + add(fontPreview68, "cell 9 14"); + + //---- fontPreview10 ---- + fontPreview10.setFontType("Mini"); + fontPreview10.setFontSize(9); + fontPreview10.setBaseSize(12); + add(fontPreview10, "cell 0 15"); + + //---- fontPreview34 ---- + fontPreview34.setFontSize(10); + fontPreview34.setFontType("Footnote / Caption 1+2"); + fontPreview34.setBaseSize(13); + add(fontPreview34, "cell 3 15"); + + //---- fontPreview78 ---- + fontPreview78.setFontType("Overline"); + fontPreview78.setFontSize(10); + fontPreview78.setBaseSize(16); + add(fontPreview78, "cell 6 15"); + + //---- fontPreview61 ---- + fontPreview61.setBaseSize(14); + fontPreview61.setFontSize(11); + fontPreview61.setFontType("h100"); + add(fontPreview61, "cell 8 15"); + // JFormDesigner - End of component initialization //GEN-END:initComponents + } + + // JFormDesigner - Variables declaration - DO NOT MODIFY //GEN-BEGIN:variables + // JFormDesigner - End of variables declaration //GEN-END:variables + + //---- class LinkLabel ---------------------------------------------------- + + static class LinkLabel + extends JLabel + { + private String linkText; + private String link; + + public LinkLabel() { + setLinkText( "Details" ); + setCursor( Cursor.getPredefinedCursor( Cursor.HAND_CURSOR ) ); + addMouseListener( new MouseAdapter() { + @Override + public void mouseClicked( MouseEvent e ) { + try { + Desktop.getDesktop().browse( new URI( link ) ); + } catch( IOException | URISyntaxException ex ) { + JOptionPane.showMessageDialog( LinkLabel.this, + "Failed to open '" + link + "' in browser.", + "Browse", JOptionPane.PLAIN_MESSAGE ); + } + } + } ); + } + + public String getLink() { + return link; + } + + public void setLink( String link ) { + this.link = link; + } + + public String getLinkText() { + return linkText; + } + + public void setLinkText( String linkText ) { + this.linkText = linkText; + setText( "" + linkText + "" ); + } + } + + //---- class FontPreview -------------------------------------------------- + + static class FontPreview + extends JPanel + { + private String fontType; + private int fontSize; + private int baseSize; + private boolean bold; + private boolean showPlain; + + private FontPreview() { + initComponents(); + preview2Label.setVisible( false ); + } + + public String getFontType() { + return fontType; + } + + public void setFontType( String fontType ) { + this.fontType = fontType; + previewLabel.setText( fontType ); + preview2Label.setText( previewLabel.getText() ); + } + + public int getFontSize() { + return fontSize; + } + + public void setFontSize( int fontSize ) { + this.fontSize = fontSize; + updateFont(); + updateDescription(); + } + + public int getBaseSize() { + return baseSize; + } + + public void setBaseSize( int baseSize ) { + this.baseSize = baseSize; + updateDescription(); + } + + public boolean isBold() { + return bold; + } + + public void setBold( boolean bold ) { + this.bold = bold; + updateFont(); + updateDescription(); + } + + public boolean isShowPlain() { + return showPlain; + } + + public void setShowPlain( boolean showPlain ) { + this.showPlain = showPlain; + preview2Label.setVisible( showPlain ); + } + + private void updateFont() { + Font defaultFont = getDefaultFont(); + previewLabel.setFont( defaultFont.deriveFont( bold ? Font.BOLD : Font.PLAIN, fontSize ) ); + preview2Label.setFont( defaultFont.deriveFont( Font.PLAIN, fontSize ) ); + } + + private void updateDescription() { + StringBuilder buf = new StringBuilder(); + buf.append( fontSize ); + if( baseSize > 0 && fontSize != baseSize ) { + buf.append( " " ).append( fontSize > baseSize ? "+" : "" ).append( fontSize - baseSize ); + buf.append( String.format( " %.2fx", (float) fontSize / baseSize ) ); + } + if( bold ) + buf.append( " bold" ); + descLabel.setText( buf.toString() ); + } + + private Font getDefaultFont() { + Font font = UIManager.getFont( "defaultFont" ); + if( font == null ) + font = UIManager.getFont( "Label.font" ); + return font; + } + + private void initComponents() { + // JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents + previewLabel = new JLabel(); + preview2Label = new JLabel(); + descLabel = new JLabel(); + + //======== this ======== + setLayout(new MigLayout( + "insets 0,hidemode 3", + // columns + "[left]", + // rows + "[]0" + + "[]")); + + //---- previewLabel ---- + previewLabel.setText("preview"); + add(previewLabel, "cell 0 0"); + add(preview2Label, "cell 0 0"); + + //---- descLabel ---- + descLabel.setText("description"); + descLabel.putClientProperty("FlatLaf.styleClass", "small"); + descLabel.setEnabled(false); + add(descLabel, "cell 0 1"); + // JFormDesigner - End of component initialization //GEN-END:initComponents + } + + // JFormDesigner - Variables declaration - DO NOT MODIFY //GEN-BEGIN:variables + private JLabel previewLabel; + private JLabel preview2Label; + private JLabel descLabel; + // JFormDesigner - End of variables declaration //GEN-END:variables + } +} diff --git a/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatTypographyTest.jfd b/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatTypographyTest.jfd new file mode 100644 index 00000000..ba115f23 --- /dev/null +++ b/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatTypographyTest.jfd @@ -0,0 +1,897 @@ +JFDML JFormDesigner: "7.0.5.0.382" Java: "16" encoding: "UTF-8" + +new FormModel { + contentType: "form/swing" + root: new FormRoot { + auxiliary() { + "JavaCodeGenerator.defaultVariableLocal": true + } + add( new FormContainer( "com.formdev.flatlaf.testing.FlatTestPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) { + "$layoutConstraints": "ltr,insets dialog,hidemode 3" + "$columnConstraints": "[left]unrel[left]unrel[left]unrel[left]unrel[left]unrel[left]unrel[left]unrel[left]unrel[left]unrel[left]unrel" + "$rowConstraints": "[top][bottom][bottom][bottom][bottom][][bottom][bottom][bottom][bottom][][bottom][][bottom][bottom][bottom]" + } ) { + name: "this" + add( new FormComponent( "javax.swing.JLabel" ) { + name: "label54" + "text": "FlatLaf
Windows" + "$client.FlatLaf.styleClass": "h1" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 0 0" + } ) + add( new FormComponent( "javax.swing.JLabel" ) { + name: "label68" + "text": "JetBrains
Windows" + "$client.FlatLaf.styleClass": "h1" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 1 0" + } ) + add( new FormComponent( "javax.swing.JLabel" ) { + name: "label69" + "text": "JetBrains
macOS" + "$client.FlatLaf.styleClass": "h1" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 2 0" + } ) + add( new FormComponent( "javax.swing.JLabel" ) { + name: "label10" + "text": "macOS" + "$client.FlatLaf.styleClass": "h1" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 3 0" + } ) + add( new FormComponent( "javax.swing.JLabel" ) { + name: "label11" + "text": "Windows 10/11" + "$client.FlatLaf.styleClass": "h1" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 4 0" + } ) + add( new FormComponent( "javax.swing.JLabel" ) { + name: "label72" + "text": "GitHub
Primer" + "$client.FlatLaf.styleClass": "h1" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 5 0" + } ) + add( new FormComponent( "javax.swing.JLabel" ) { + name: "label28" + "text": "Material" + "$client.FlatLaf.styleClass": "h1" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 6 0" + } ) + add( new FormComponent( "javax.swing.JLabel" ) { + name: "label1" + "text": "SAP Fiori" + "$client.FlatLaf.styleClass": "h1" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 7 0" + } ) + add( new FormComponent( "javax.swing.JLabel" ) { + name: "label37" + "text": "Atlassian" + "$client.FlatLaf.styleClass": "h1" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 8 0" + } ) + add( new FormComponent( "javax.swing.JLabel" ) { + name: "label46" + "text": "Iris" + "$client.FlatLaf.styleClass": "h1" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 9 0" + } ) + add( new FormComponent( "com.formdev.flatlaf.testing.FlatTypographyTest$LinkLabel" ) { + name: "linkLabel9" + "link": "https://www.formdev.com/flatlaf/typography/" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 0 1" + } ) + add( new FormComponent( "com.formdev.flatlaf.testing.FlatTypographyTest$LinkLabel" ) { + name: "linkLabel1" + "link": "https://jetbrains.design/intellij/principles/typography/" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 1 1" + } ) + add( new FormComponent( "com.formdev.flatlaf.testing.FlatTypographyTest$LinkLabel" ) { + name: "linkLabel2" + "link": "https://developer.apple.com/design/human-interface-guidelines/macos/visual-design/typography/" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 3 1" + } ) + add( new FormComponent( "com.formdev.flatlaf.testing.FlatTypographyTest$LinkLabel" ) { + name: "linkLabel3" + "link": "https://docs.microsoft.com/en-us/windows/apps/design/style/typography#type-ramp" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 4 1" + } ) + add( new FormComponent( "javax.swing.JLabel" ) { + name: "label2" + "text": "/" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 4 1" + } ) + add( new FormComponent( "com.formdev.flatlaf.testing.FlatTypographyTest$LinkLabel" ) { + name: "linkLabel4" + "link": "https://docs.microsoft.com/en-us/windows/apps/design/signature-experiences/typography#type-ramp" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 4 1" + } ) + add( new FormComponent( "com.formdev.flatlaf.testing.FlatTypographyTest$LinkLabel" ) { + name: "linkLabel10" + "link": "https://primer.style/css/utilities/typography" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 5 1" + } ) + add( new FormComponent( "com.formdev.flatlaf.testing.FlatTypographyTest$LinkLabel" ) { + name: "linkLabel8" + "link": "https://material.io/design/typography/the-type-system.html#type-scale" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 6 1" + } ) + add( new FormComponent( "com.formdev.flatlaf.testing.FlatTypographyTest$LinkLabel" ) { + name: "linkLabel5" + "link": "https://experience.sap.com/fiori-design-web/typography/#headlines-and-font-styles-for-ui-controls" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 7 1" + } ) + add( new FormComponent( "com.formdev.flatlaf.testing.FlatTypographyTest$LinkLabel" ) { + name: "linkLabel6" + "link": "https://atlassian.design/foundations/typography" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 8 1" + } ) + add( new FormComponent( "com.formdev.flatlaf.testing.FlatTypographyTest$LinkLabel" ) { + name: "linkLabel7" + "link": "https://iris.alkamitech.com/foundations/typography.html" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 9 1" + } ) + add( new FormComponent( "com.formdev.flatlaf.testing.FlatTypographyTest$FontPreview" ) { + name: "fontPreview69" + "fontType": "H1" + "fontSize": 96 + "baseSize": 16 + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 6 2" + } ) + add( new FormComponent( "com.formdev.flatlaf.testing.FlatTypographyTest$FontPreview" ) { + name: "fontPreview93" + "baseSize": 12 + "fontType": "H00" + "fontSize": 36 + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 0 3" + } ) + add( new FormComponent( "com.formdev.flatlaf.testing.FlatTypographyTest$FontPreview" ) { + name: "fontPreview40" + "fontSize": 68 + "fontType": "Display" + "baseSize": 14 + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 4 2 1 2" + } ) + add( new FormComponent( "com.formdev.flatlaf.testing.FlatTypographyTest$FontPreview" ) { + name: "fontPreview85" + "fontSize": 48 + "fontType": "H00" + "baseSize": 16 + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 5 3" + } ) + add( new FormComponent( "com.formdev.flatlaf.testing.FlatTypographyTest$FontPreview" ) { + name: "fontPreview70" + "fontSize": 60 + "fontType": "H2" + "baseSize": 16 + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 6 3" + } ) + add( new FormComponent( "com.formdev.flatlaf.testing.FlatTypographyTest$FontPreview" ) { + name: "fontPreview51" + "fontType": "h900" + "fontSize": 35 + "baseSize": 14 + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 8 3" + } ) + add( new FormComponent( "com.formdev.flatlaf.testing.FlatTypographyTest$FontPreview" ) { + name: "fontPreview1" + "baseSize": 12 + "fontType": "H0" + "fontSize": 30 + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 0 4" + } ) + add( new FormComponent( "com.formdev.flatlaf.testing.FlatTypographyTest$FontPreview" ) { + name: "fontPreview11" + "fontType": "H0" + "fontSize": 24 + "bold": true + "baseSize": 12 + "showPlain": true + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 1 4" + } ) + add( new FormComponent( "com.formdev.flatlaf.testing.FlatTypographyTest$FontPreview" ) { + name: "fontPreview19" + "fontType": "H0" + "fontSize": 25 + "bold": true + "baseSize": 13 + "showPlain": true + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 2 4" + } ) + add( new FormComponent( "com.formdev.flatlaf.testing.FlatTypographyTest$FontPreview" ) { + name: "fontPreview27" + "fontType": "Large Title" + "fontSize": 26 + "baseSize": 13 + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 3 4" + } ) + add( new FormComponent( "com.formdev.flatlaf.testing.FlatTypographyTest$FontPreview" ) { + name: "fontPreview41" + "fontType": "Title Large" + "fontSize": 40 + "baseSize": 14 + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 4 4" + } ) + add( new FormComponent( "com.formdev.flatlaf.testing.FlatTypographyTest$FontPreview" ) { + name: "fontPreview86" + "fontSize": 40 + "fontType": "H0" + "baseSize": 16 + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 5 4" + } ) + add( new FormComponent( "com.formdev.flatlaf.testing.FlatTypographyTest$FontPreview" ) { + name: "fontPreview71" + "fontType": "H3" + "fontSize": 48 + "baseSize": 16 + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 6 4" + } ) + add( new FormComponent( "com.formdev.flatlaf.testing.FlatTypographyTest$FontPreview" ) { + name: "fontPreview47" + "fontType": "Header 1" + "fontSize": 36 + "baseSize": 14 + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 7 4" + } ) + add( new FormComponent( "com.formdev.flatlaf.testing.FlatTypographyTest$FontPreview" ) { + name: "fontPreview54" + "baseSize": 14 + "fontType": "h800" + "fontSize": 29 + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 8 4" + } ) + add( new FormComponent( "com.formdev.flatlaf.testing.FlatTypographyTest$FontPreview" ) { + name: "fontPreview62" + "baseSize": 16 + "fontSize": 44 + "fontType": "Hero" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 9 4" + } ) + add( new FormComponent( "javax.swing.JSeparator" ) { + name: "separator3" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 0 5 10 1,growx" + } ) + add( new FormComponent( "com.formdev.flatlaf.testing.FlatTypographyTest$FontPreview" ) { + name: "fontPreview2" + "baseSize": 12 + "fontSize": 24 + "fontType": "H1" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 0 6" + } ) + add( new FormComponent( "com.formdev.flatlaf.testing.FlatTypographyTest$FontPreview" ) { + name: "fontPreview12" + "fontType": "H1" + "fontSize": 21 + "bold": true + "baseSize": 12 + "showPlain": true + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 1 6" + } ) + add( new FormComponent( "com.formdev.flatlaf.testing.FlatTypographyTest$FontPreview" ) { + name: "fontPreview20" + "fontType": "H1" + "fontSize": 22 + "bold": true + "baseSize": 13 + "showPlain": true + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 2 6" + } ) + add( new FormComponent( "com.formdev.flatlaf.testing.FlatTypographyTest$FontPreview" ) { + name: "fontPreview28" + "fontSize": 22 + "fontType": "Title 1" + "baseSize": 13 + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 3 6" + } ) + add( new FormComponent( "com.formdev.flatlaf.testing.FlatTypographyTest$FontPreview" ) { + name: "fontPreview42" + "fontType": "Title" + "fontSize": 28 + "baseSize": 14 + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 4 6" + } ) + add( new FormComponent( "com.formdev.flatlaf.testing.FlatTypographyTest$FontPreview" ) { + name: "fontPreview87" + "fontType": "H1" + "fontSize": 32 + "baseSize": 16 + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 5 6" + } ) + add( new FormComponent( "com.formdev.flatlaf.testing.FlatTypographyTest$FontPreview" ) { + name: "fontPreview72" + "fontType": "H4" + "fontSize": 34 + "baseSize": 16 + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 6 6" + } ) + add( new FormComponent( "com.formdev.flatlaf.testing.FlatTypographyTest$FontPreview" ) { + name: "fontPreview48" + "fontType": "Header 2" + "fontSize": 24 + "baseSize": 14 + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 7 6" + } ) + add( new FormComponent( "com.formdev.flatlaf.testing.FlatTypographyTest$FontPreview" ) { + name: "fontPreview55" + "baseSize": 14 + "fontType": "h700" + "fontSize": 24 + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 8 6" + } ) + add( new FormComponent( "com.formdev.flatlaf.testing.FlatTypographyTest$FontPreview" ) { + name: "fontPreview63" + "baseSize": 16 + "fontSize": 32 + "fontType": "H1" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 9 6" + } ) + add( new FormComponent( "com.formdev.flatlaf.testing.FlatTypographyTest$FontPreview" ) { + name: "fontPreview3" + "baseSize": 12 + "fontSize": 18 + "fontType": "H2" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 0 7" + } ) + add( new FormComponent( "com.formdev.flatlaf.testing.FlatTypographyTest$FontPreview" ) { + name: "fontPreview13" + "fontType": "H2" + "fontSize": 17 + "bold": true + "baseSize": 12 + "showPlain": true + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 1 7" + } ) + add( new FormComponent( "com.formdev.flatlaf.testing.FlatTypographyTest$FontPreview" ) { + name: "fontPreview21" + "fontType": "H2" + "fontSize": 18 + "bold": true + "baseSize": 13 + "showPlain": true + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 2 7" + } ) + add( new FormComponent( "com.formdev.flatlaf.testing.FlatTypographyTest$FontPreview" ) { + name: "fontPreview29" + "fontSize": 17 + "fontType": "Title 2" + "baseSize": 13 + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 3 7" + } ) + add( new FormComponent( "com.formdev.flatlaf.testing.FlatTypographyTest$FontPreview" ) { + name: "fontPreview43" + "fontType": "Subtitle" + "fontSize": 20 + "baseSize": 14 + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 4 7" + } ) + add( new FormComponent( "com.formdev.flatlaf.testing.FlatTypographyTest$FontPreview" ) { + name: "fontPreview88" + "fontSize": 24 + "fontType": "H2" + "baseSize": 16 + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 5 7" + } ) + add( new FormComponent( "com.formdev.flatlaf.testing.FlatTypographyTest$FontPreview" ) { + name: "fontPreview73" + "fontType": "H5" + "fontSize": 24 + "baseSize": 16 + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 6 7" + } ) + add( new FormComponent( "com.formdev.flatlaf.testing.FlatTypographyTest$FontPreview" ) { + name: "fontPreview49" + "fontType": "Header 3" + "fontSize": 20 + "baseSize": 14 + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 7 7" + } ) + add( new FormComponent( "com.formdev.flatlaf.testing.FlatTypographyTest$FontPreview" ) { + name: "fontPreview57" + "baseSize": 14 + "fontType": "h600" + "fontSize": 20 + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 8 7" + } ) + add( new FormComponent( "com.formdev.flatlaf.testing.FlatTypographyTest$FontPreview" ) { + name: "fontPreview64" + "baseSize": 16 + "fontType": "H2" + "fontSize": 24 + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 9 7" + } ) + add( new FormComponent( "com.formdev.flatlaf.testing.FlatTypographyTest$FontPreview" ) { + name: "fontPreview4" + "baseSize": 12 + "fontSize": 15 + "fontType": "H3" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 0 8" + } ) + add( new FormComponent( "com.formdev.flatlaf.testing.FlatTypographyTest$FontPreview" ) { + name: "fontPreview14" + "fontType": "H3" + "fontSize": 15 + "bold": true + "baseSize": 12 + "showPlain": true + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 1 8" + } ) + add( new FormComponent( "com.formdev.flatlaf.testing.FlatTypographyTest$FontPreview" ) { + name: "fontPreview22" + "fontType": "H3" + "fontSize": 16 + "bold": true + "baseSize": 13 + "showPlain": true + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 2 8" + } ) + add( new FormComponent( "com.formdev.flatlaf.testing.FlatTypographyTest$FontPreview" ) { + name: "fontPreview30" + "fontType": "Title 3" + "fontSize": 15 + "baseSize": 13 + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 3 8" + } ) + add( new FormComponent( "com.formdev.flatlaf.testing.FlatTypographyTest$FontPreview" ) { + name: "fontPreview89" + "fontType": "H3" + "fontSize": 20 + "baseSize": 16 + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 5 8" + } ) + add( new FormComponent( "com.formdev.flatlaf.testing.FlatTypographyTest$FontPreview" ) { + name: "fontPreview74" + "fontType": "H6" + "fontSize": 20 + "baseSize": 16 + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 6 8" + } ) + add( new FormComponent( "com.formdev.flatlaf.testing.FlatTypographyTest$FontPreview" ) { + name: "fontPreview50" + "fontType": "Header 4" + "fontSize": 18 + "baseSize": 14 + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 7 8" + } ) + add( new FormComponent( "com.formdev.flatlaf.testing.FlatTypographyTest$FontPreview" ) { + name: "fontPreview58" + "baseSize": 14 + "fontType": "h500" + "fontSize": 16 + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 8 8" + } ) + add( new FormComponent( "com.formdev.flatlaf.testing.FlatTypographyTest$FontPreview" ) { + name: "fontPreview65" + "baseSize": 16 + "fontSize": 20 + "fontType": "H3" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 9 8" + } ) + add( new FormComponent( "com.formdev.flatlaf.testing.FlatTypographyTest$FontPreview" ) { + name: "fontPreview5" + "baseSize": 12 + "fontSize": 14 + "fontType": "Large" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 0 9" + } ) + add( new FormComponent( "com.formdev.flatlaf.testing.FlatTypographyTest$FontPreview" ) { + name: "fontPreview15" + "fontType": "H4" + "bold": true + "fontSize": 12 + "baseSize": 12 + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 1 9" + } ) + add( new FormComponent( "com.formdev.flatlaf.testing.FlatTypographyTest$FontPreview" ) { + name: "fontPreview23" + "fontType": "H4" + "fontSize": 13 + "bold": true + "baseSize": 13 + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 2 9" + } ) + add( new FormComponent( "com.formdev.flatlaf.testing.FlatTypographyTest$FontPreview" ) { + name: "fontPreview31" + "fontType": "Headline" + "fontSize": 13 + "bold": true + "baseSize": 13 + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 3 9" + } ) + add( new FormComponent( "com.formdev.flatlaf.testing.FlatTypographyTest$FontPreview" ) { + name: "fontPreview44" + "fontSize": 18 + "fontType": "Body Large" + "baseSize": 14 + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 4 9" + } ) + add( new FormComponent( "com.formdev.flatlaf.testing.FlatTypographyTest$FontPreview" ) { + name: "fontPreview56" + "fontType": "Large Text / Header 5" + "fontSize": 16 + "baseSize": 14 + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 7 9" + } ) + add( new FormComponent( "com.formdev.flatlaf.testing.FlatTypographyTest$FontPreview" ) { + name: "fontPreview66" + "baseSize": 16 + "fontType": "H4" + "fontSize": 18 + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 9 9" + } ) + add( new FormComponent( "javax.swing.JSeparator" ) { + name: "separator1" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 0 10 10 1,growx" + } ) + add( new FormComponent( "com.formdev.flatlaf.testing.FlatTypographyTest$FontPreview" ) { + name: "fontPreview7" + "fontType": "Default" + "fontSize": 12 + "baseSize": 12 + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 0 11" + } ) + add( new FormComponent( "com.formdev.flatlaf.testing.FlatTypographyTest$FontPreview" ) { + name: "fontPreview6" + "fontSize": 12 + "bold": true + "fontType": "H4" + "baseSize": 12 + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 0 11" + } ) + add( new FormComponent( "com.formdev.flatlaf.testing.FlatTypographyTest$FontPreview" ) { + name: "fontPreview16" + "fontType": "Default" + "fontSize": 12 + "baseSize": 12 + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 1 11" + } ) + add( new FormComponent( "com.formdev.flatlaf.testing.FlatTypographyTest$FontPreview" ) { + name: "fontPreview24" + "fontType": "Default" + "fontSize": 13 + "baseSize": 13 + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 2 11" + } ) + add( new FormComponent( "com.formdev.flatlaf.testing.FlatTypographyTest$FontPreview" ) { + name: "fontPreview32" + "fontType": "Body" + "fontSize": 13 + "baseSize": 13 + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 3 11" + } ) + add( new FormComponent( "com.formdev.flatlaf.testing.FlatTypographyTest$FontPreview" ) { + name: "fontPreview45" + "fontType": "Body" + "fontSize": 14 + "baseSize": 14 + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 4 11" + } ) + add( new FormComponent( "com.formdev.flatlaf.testing.FlatTypographyTest$FontPreview" ) { + name: "fontPreview90" + "fontSize": 16 + "fontType": "Body / H4" + "baseSize": 16 + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 5 11" + } ) + add( new FormComponent( "com.formdev.flatlaf.testing.FlatTypographyTest$FontPreview" ) { + name: "fontPreview75" + "fontSize": 16 + "fontType": "Body 1 / Subtitle 1" + "baseSize": 16 + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 6 11" + } ) + add( new FormComponent( "com.formdev.flatlaf.testing.FlatTypographyTest$FontPreview" ) { + name: "fontPreview52" + "fontType": "Medium Text / Header 6" + "fontSize": 14 + "baseSize": 14 + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 7 11" + } ) + add( new FormComponent( "com.formdev.flatlaf.testing.FlatTypographyTest$FontPreview" ) { + name: "fontPreview59" + "baseSize": 14 + "fontSize": 14 + "fontType": "h400" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 8 11" + } ) + add( new FormComponent( "com.formdev.flatlaf.testing.FlatTypographyTest$FontPreview" ) { + name: "fontPreview67" + "baseSize": 16 + "fontSize": 16 + "fontType": "Body" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 9 11" + } ) + add( new FormComponent( "javax.swing.JSeparator" ) { + name: "separator2" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 0 12 10 1,growx" + } ) + add( new FormComponent( "com.formdev.flatlaf.testing.FlatTypographyTest$FontPreview" ) { + name: "fontPreview8" + "fontType": "Medium" + "fontSize": 11 + "baseSize": 12 + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 0 13" + } ) + add( new FormComponent( "com.formdev.flatlaf.testing.FlatTypographyTest$FontPreview" ) { + name: "fontPreview17" + "fontType": "Medium" + "fontSize": 12 + "baseSize": 12 + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 1 13" + } ) + add( new FormComponent( "com.formdev.flatlaf.testing.FlatTypographyTest$FontPreview" ) { + name: "fontPreview25" + "fontType": "Medium" + "fontSize": 12 + "baseSize": 13 + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 2 13" + } ) + add( new FormComponent( "com.formdev.flatlaf.testing.FlatTypographyTest$FontPreview" ) { + name: "fontPreview39" + "fontSize": 12 + "fontType": "Callout" + "baseSize": 13 + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 3 13" + } ) + add( new FormComponent( "com.formdev.flatlaf.testing.FlatTypographyTest$FontPreview" ) { + name: "fontPreview91" + "fontType": "H5" + "fontSize": 14 + "baseSize": 16 + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 5 13" + } ) + add( new FormComponent( "com.formdev.flatlaf.testing.FlatTypographyTest$FontPreview" ) { + name: "fontPreview76" + "fontType": "Body 2 / Subtitle 2" + "fontSize": 14 + "baseSize": 16 + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 6 13" + } ) + add( new FormComponent( "com.formdev.flatlaf.testing.FlatTypographyTest$FontPreview" ) { + name: "fontPreview9" + "fontType": "Small" + "fontSize": 10 + "baseSize": 12 + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 0 14" + } ) + add( new FormComponent( "com.formdev.flatlaf.testing.FlatTypographyTest$FontPreview" ) { + name: "fontPreview18" + "fontType": "Small" + "fontSize": 12 + "baseSize": 12 + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 1 14" + } ) + add( new FormComponent( "com.formdev.flatlaf.testing.FlatTypographyTest$FontPreview" ) { + name: "fontPreview26" + "fontType": "Small" + "fontSize": 11 + "baseSize": 13 + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 2 14" + } ) + add( new FormComponent( "com.formdev.flatlaf.testing.FlatTypographyTest$FontPreview" ) { + name: "fontPreview33" + "fontType": "Subheadline" + "fontSize": 11 + "baseSize": 13 + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 3 14" + } ) + add( new FormComponent( "com.formdev.flatlaf.testing.FlatTypographyTest$FontPreview" ) { + name: "fontPreview46" + "fontType": "Caption" + "fontSize": 12 + "baseSize": 14 + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 4 14" + } ) + add( new FormComponent( "com.formdev.flatlaf.testing.FlatTypographyTest$FontPreview" ) { + name: "fontPreview92" + "fontSize": 12 + "fontType": "H6" + "baseSize": 12 + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 5 14" + } ) + add( new FormComponent( "com.formdev.flatlaf.testing.FlatTypographyTest$FontPreview" ) { + name: "fontPreview77" + "fontSize": 12 + "fontType": "Caption" + "baseSize": 16 + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 6 14" + } ) + add( new FormComponent( "com.formdev.flatlaf.testing.FlatTypographyTest$FontPreview" ) { + name: "fontPreview53" + "fontType": "Small Text" + "fontSize": 12 + "baseSize": 14 + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 7 14" + } ) + add( new FormComponent( "com.formdev.flatlaf.testing.FlatTypographyTest$FontPreview" ) { + name: "fontPreview60" + "baseSize": 14 + "fontType": "h300 / h200" + "fontSize": 12 + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 8 14" + } ) + add( new FormComponent( "com.formdev.flatlaf.testing.FlatTypographyTest$FontPreview" ) { + name: "fontPreview68" + "baseSize": 16 + "fontType": "Small" + "fontSize": 14 + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 9 14" + } ) + add( new FormComponent( "com.formdev.flatlaf.testing.FlatTypographyTest$FontPreview" ) { + name: "fontPreview10" + "fontType": "Mini" + "fontSize": 9 + "baseSize": 12 + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 0 15" + } ) + add( new FormComponent( "com.formdev.flatlaf.testing.FlatTypographyTest$FontPreview" ) { + name: "fontPreview34" + "fontSize": 10 + "fontType": "Footnote / Caption 1+2" + "baseSize": 13 + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 3 15" + } ) + add( new FormComponent( "com.formdev.flatlaf.testing.FlatTypographyTest$FontPreview" ) { + name: "fontPreview78" + "fontType": "Overline" + "fontSize": 10 + "baseSize": 16 + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 6 15" + } ) + add( new FormComponent( "com.formdev.flatlaf.testing.FlatTypographyTest$FontPreview" ) { + name: "fontPreview61" + "baseSize": 14 + "fontSize": 11 + "fontType": "h100" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 8 15" + } ) + }, new FormLayoutConstraints( null ) { + "location": new java.awt.Point( 5, 0 ) + "size": new java.awt.Dimension( 1430, 855 ) + } ) + add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) { + "$layoutConstraints": "insets 0,hidemode 3" + "$columnConstraints": "[left]" + "$rowConstraints": "[]0[]" + } ) { + name: "panel1" + auxiliary() { + "JavaCodeGenerator.className": "FontPreview" + "JavaCodeGenerator.variableName": "fontPreview" + } + add( new FormComponent( "javax.swing.JLabel" ) { + name: "previewLabel" + "text": "preview" + auxiliary() { + "JavaCodeGenerator.variableLocal": false + } + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 0 0" + } ) + add( new FormComponent( "javax.swing.JLabel" ) { + name: "preview2Label" + auxiliary() { + "JavaCodeGenerator.variableLocal": false + } + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 0 0" + } ) + add( new FormComponent( "javax.swing.JLabel" ) { + name: "descLabel" + "text": "description" + "$client.FlatLaf.styleClass": "small" + "enabled": false + auxiliary() { + "JavaCodeGenerator.variableLocal": false + } + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 0 1" + } ) + }, new FormLayoutConstraints( null ) { + "location": new java.awt.Point( 10, 925 ) + "size": new java.awt.Dimension( 105, 85 ) + } ) + } +} From e560f9cbd63c30c5b7ada4ae1c281869c88250c0 Mon Sep 17 00:00:00 2001 From: Karl Tauber Date: Wed, 13 Oct 2021 15:47:55 +0200 Subject: [PATCH 07/22] Typography: added typography/fonts preview to theme editor --- .../flatlaf/themeeditor/FlatThemePreview.java | 4 + .../flatlaf/themeeditor/FlatThemePreview.jfd | 1 + .../themeeditor/FlatThemePreviewFonts.java | 252 ++++++++++++++++++ .../themeeditor/FlatThemePreviewFonts.jfd | 169 ++++++++++++ 4 files changed, 426 insertions(+) create mode 100644 flatlaf-theme-editor/src/main/java/com/formdev/flatlaf/themeeditor/FlatThemePreviewFonts.java create mode 100644 flatlaf-theme-editor/src/main/java/com/formdev/flatlaf/themeeditor/FlatThemePreviewFonts.jfd 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 aa3b4767..355fbf7c 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 @@ -46,6 +46,7 @@ class FlatThemePreview private final FlatThemePreviewAll allTab; private final FlatThemePreviewButtons buttonsTab; private final FlatThemePreviewSwitches switchesTab; + private final FlatThemePreviewFonts fontsTab; private final Map lazyValueCache = new WeakHashMap<>(); private int runWithUIDefaultsGetterLevel; @@ -61,9 +62,11 @@ class FlatThemePreview allTab = new FlatThemePreviewAll( this ); buttonsTab = new FlatThemePreviewButtons( this ); switchesTab = new FlatThemePreviewSwitches(); + fontsTab = new FlatThemePreviewFonts(); tabbedPane.addTab( "All", createPreviewTab( allTab ) ); tabbedPane.addTab( "Buttons", createPreviewTab( buttonsTab ) ); tabbedPane.addTab( "Switches", createPreviewTab( switchesTab ) ); + tabbedPane.addTab( "Fonts", createPreviewTab( fontsTab ) ); selectRecentTab(); tabbedPane.addChangeListener( e -> selectedTabChanged() ); @@ -214,6 +217,7 @@ class FlatThemePreview { tabbedPane.setLeadingComponent(previewLabel); tabbedPane.setTabAreaAlignment(FlatTabbedPane.TabAreaAlignment.trailing); + tabbedPane.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT); } add(tabbedPane, BorderLayout.CENTER); 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 202fa0e8..fa580f61 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 @@ -9,6 +9,7 @@ new FormModel { name: "tabbedPane" "leadingComponent": new FormReference( "previewLabel" ) "tabAreaAlignment": enum com.formdev.flatlaf.extras.components.FlatTabbedPane$TabAreaAlignment trailing + "tabLayoutPolicy": 1 }, new FormLayoutConstraints( class java.lang.String ) { "value": "Center" } ) 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 new file mode 100644 index 00000000..88385b6c --- /dev/null +++ b/flatlaf-theme-editor/src/main/java/com/formdev/flatlaf/themeeditor/FlatThemePreviewFonts.java @@ -0,0 +1,252 @@ +/* +/* + * Copyright 2021 FormDev Software GmbH + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.formdev.flatlaf.themeeditor; + +import java.awt.*; +import java.text.DecimalFormat; +import javax.swing.*; +import com.formdev.flatlaf.FlatClientProperties; +import com.formdev.flatlaf.util.UIScale; +import net.miginfocom.swing.*; + +/** + * @author Karl Tauber + */ +public class FlatThemePreviewFonts + extends JPanel +{ + private static final DecimalFormat SCALE_FORMAT = new DecimalFormat( "0.##x" ); + + public FlatThemePreviewFonts() { + initComponents(); + + scaleValueLabel.setText( SCALE_FORMAT.format( UIScale.getUserScaleFactor() ) ); + } + + private void initComponents() { + // JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents + JLabel headingsLabel = new JLabel(); + FlatThemePreviewFonts.FontPreview h00Preview = new FlatThemePreviewFonts.FontPreview(); + FlatThemePreviewFonts.FontPreview h0Preview = new FlatThemePreviewFonts.FontPreview(); + FlatThemePreviewFonts.FontPreview h1Preview = new FlatThemePreviewFonts.FontPreview(); + FlatThemePreviewFonts.FontPreview h2Preview = new FlatThemePreviewFonts.FontPreview(); + FlatThemePreviewFonts.FontPreview h3Preview = new FlatThemePreviewFonts.FontPreview(); + FlatThemePreviewFonts.FontPreview h4Preview = new FlatThemePreviewFonts.FontPreview(); + JLabel textLabel = new JLabel(); + FlatThemePreviewFonts.FontPreview largePreview = new FlatThemePreviewFonts.FontPreview(); + defaultPreview = new FlatThemePreviewFonts.FontPreview(); + FlatThemePreviewFonts.FontPreview mediumPreview = new FlatThemePreviewFonts.FontPreview(); + FlatThemePreviewFonts.FontPreview smallPreview = new FlatThemePreviewFonts.FontPreview(); + FlatThemePreviewFonts.FontPreview miniPreview = new FlatThemePreviewFonts.FontPreview(); + FlatThemePreviewFonts.FontPreview monospacedPreview = new FlatThemePreviewFonts.FontPreview(); + JLabel scaleLabel = new JLabel(); + scaleValueLabel = new JLabel(); + + //======== this ======== + setLayout(new MigLayout( + "ltr,insets dialog,hidemode 3", + // columns + "[left]unrel", + // rows + "[]" + + "[bottom]" + + "[bottom]" + + "[bottom]" + + "[bottom]" + + "[bottom]" + + "[bottom]para" + + "[]" + + "[bottom]" + + "[bottom]" + + "[bottom]" + + "[bottom]" + + "[bottom]para" + + "[]para" + + "[]")); + + //---- headingsLabel ---- + headingsLabel.setText("Headings"); + headingsLabel.putClientProperty("FlatLaf.styleClass", "h3"); + add(headingsLabel, "cell 0 0"); + + //---- h00Preview ---- + h00Preview.setFontType("H00"); + h00Preview.setFontStyle("h00"); + add(h00Preview, "cell 0 1,gapx 12"); + + //---- h0Preview ---- + h0Preview.setFontType("H0"); + h0Preview.setFontStyle("h0"); + add(h0Preview, "cell 0 2,gapx 12"); + + //---- h1Preview ---- + h1Preview.setFontType("H1"); + h1Preview.setFontStyle("h1"); + add(h1Preview, "cell 0 3,gapx 12"); + + //---- h2Preview ---- + h2Preview.setFontType("H2"); + h2Preview.setFontStyle("h2"); + add(h2Preview, "cell 0 4,gapx 12"); + + //---- h3Preview ---- + h3Preview.setFontType("H3"); + h3Preview.setFontStyle("h3"); + add(h3Preview, "cell 0 5,gapx 12"); + + //---- h4Preview ---- + h4Preview.setFontType("H4"); + h4Preview.setFontStyle("h4"); + add(h4Preview, "cell 0 6,gapx 12"); + + //---- textLabel ---- + textLabel.setText("Text"); + textLabel.putClientProperty("FlatLaf.styleClass", "h3"); + add(textLabel, "cell 0 7"); + + //---- largePreview ---- + largePreview.setFontType("Large"); + largePreview.setFontStyle("large"); + add(largePreview, "cell 0 8,gapx 12"); + + //---- defaultPreview ---- + defaultPreview.setFontType("Default"); + add(defaultPreview, "cell 0 9,gapx 12"); + + //---- mediumPreview ---- + mediumPreview.setFontType("Medium"); + mediumPreview.setFontStyle("medium"); + add(mediumPreview, "cell 0 10,gapx 12"); + + //---- smallPreview ---- + smallPreview.setFontType("Small"); + smallPreview.setFontStyle("small"); + add(smallPreview, "cell 0 11,gapx 12"); + + //---- miniPreview ---- + miniPreview.setFontType("Mini"); + miniPreview.setFontStyle("mini"); + add(miniPreview, "cell 0 12,gapx 12"); + + //---- monospacedPreview ---- + monospacedPreview.setFontType("Monospaced"); + monospacedPreview.setFontStyle("monospaced"); + add(monospacedPreview, "cell 0 13,gapx 12"); + + //---- scaleLabel ---- + scaleLabel.setText("Fonts are scaled by:"); + add(scaleLabel, "cell 0 14,gapx 12"); + + //---- scaleValueLabel ---- + scaleValueLabel.setText("1x"); + scaleValueLabel.putClientProperty("FlatLaf.styleClass", "h2"); + add(scaleValueLabel, "cell 0 14"); + // JFormDesigner - End of component initialization //GEN-END:initComponents + } + + // JFormDesigner - Variables declaration - DO NOT MODIFY //GEN-BEGIN:variables + private FlatThemePreviewFonts.FontPreview defaultPreview; + private JLabel scaleValueLabel; + // JFormDesigner - End of variables declaration //GEN-END:variables + + //---- class FontPreview -------------------------------------------------- + + static class FontPreview + extends JPanel + { + private String fontType; + private String fontStyle; + + private FontPreview() { + initComponents(); + + updateDescription( previewLabel.getFont() ); + previewLabel.addPropertyChangeListener( "font", e -> { + updateDescription( (Font) e.getNewValue() ); + } ); + } + + public String getFontType() { + return fontType; + } + + public void setFontType( String fontType ) { + this.fontType = fontType; + previewLabel.setText( fontType ); + } + + public String getFontStyle() { + return fontStyle; + } + + public void setFontStyle( String fontStyle ) { + this.fontStyle = fontStyle; + previewLabel.putClientProperty( FlatClientProperties.STYLE_CLASS, fontStyle ); + } + + private void updateDescription( Font font ) { + int baseSize = getDefaultFont().getSize(); + int fontSize = font.getSize(); + + descLabel.setText( String.format( "%s %d %s%s (%+d %s)", + font.getFamily(), + fontSize, + (font.getStyle() & Font.BOLD) != 0 ? " bold" : "", + (font.getStyle() & Font.ITALIC) != 0 ? " italic" : "", + fontSize - baseSize, + SCALE_FORMAT.format( (float) fontSize / baseSize ) ) ); + } + + private Font getDefaultFont() { + Font font = UIManager.getFont( "defaultFont" ); + if( font == null ) + font = UIManager.getFont( "Label.font" ); + return font; + } + + private void initComponents() { + // JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents + previewLabel = new JLabel(); + descLabel = new JLabel(); + + //======== this ======== + setLayout(new MigLayout( + "insets 0,hidemode 3", + // columns + "[90,left]" + + "[fill]", + // rows + "[]0")); + + //---- previewLabel ---- + previewLabel.setText("preview"); + add(previewLabel, "cell 0 0"); + + //---- descLabel ---- + descLabel.setText("description"); + descLabel.putClientProperty("FlatLaf.styleClass", "medium"); + add(descLabel, "cell 1 0"); + // JFormDesigner - End of component initialization //GEN-END:initComponents + } + + // JFormDesigner - Variables declaration - DO NOT MODIFY //GEN-BEGIN:variables + private JLabel previewLabel; + private JLabel descLabel; + // JFormDesigner - End of variables declaration //GEN-END:variables + } +} diff --git a/flatlaf-theme-editor/src/main/java/com/formdev/flatlaf/themeeditor/FlatThemePreviewFonts.jfd b/flatlaf-theme-editor/src/main/java/com/formdev/flatlaf/themeeditor/FlatThemePreviewFonts.jfd new file mode 100644 index 00000000..e7700964 --- /dev/null +++ b/flatlaf-theme-editor/src/main/java/com/formdev/flatlaf/themeeditor/FlatThemePreviewFonts.jfd @@ -0,0 +1,169 @@ +JFDML JFormDesigner: "7.0.5.0.382" Java: "16" encoding: "UTF-8" + +new FormModel { + contentType: "form/swing" + root: new FormRoot { + auxiliary() { + "JavaCodeGenerator.defaultVariableLocal": true + } + add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) { + "$layoutConstraints": "ltr,insets dialog,hidemode 3" + "$columnConstraints": "[left]unrel" + "$rowConstraints": "[][bottom][bottom][bottom][bottom][bottom][bottom]para[][bottom][bottom][bottom][bottom][bottom]para[]para[]" + } ) { + name: "this" + add( new FormComponent( "javax.swing.JLabel" ) { + name: "headingsLabel" + "text": "Headings" + "$client.FlatLaf.styleClass": "h3" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 0 0" + } ) + add( new FormComponent( "com.formdev.flatlaf.themeeditor.FlatThemePreviewFonts$FontPreview" ) { + name: "h00Preview" + "fontType": "H00" + "fontStyle": "h00" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 0 1,gapx 12" + } ) + add( new FormComponent( "com.formdev.flatlaf.themeeditor.FlatThemePreviewFonts$FontPreview" ) { + name: "h0Preview" + "fontType": "H0" + "fontStyle": "h0" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 0 2,gapx 12" + } ) + add( new FormComponent( "com.formdev.flatlaf.themeeditor.FlatThemePreviewFonts$FontPreview" ) { + name: "h1Preview" + "fontType": "H1" + "fontStyle": "h1" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 0 3,gapx 12" + } ) + add( new FormComponent( "com.formdev.flatlaf.themeeditor.FlatThemePreviewFonts$FontPreview" ) { + name: "h2Preview" + "fontType": "H2" + "fontStyle": "h2" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 0 4,gapx 12" + } ) + add( new FormComponent( "com.formdev.flatlaf.themeeditor.FlatThemePreviewFonts$FontPreview" ) { + name: "h3Preview" + "fontType": "H3" + "fontStyle": "h3" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 0 5,gapx 12" + } ) + add( new FormComponent( "com.formdev.flatlaf.themeeditor.FlatThemePreviewFonts$FontPreview" ) { + name: "h4Preview" + "fontType": "H4" + "fontStyle": "h4" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 0 6,gapx 12" + } ) + add( new FormComponent( "javax.swing.JLabel" ) { + name: "textLabel" + "text": "Text" + "$client.FlatLaf.styleClass": "h3" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 0 7" + } ) + add( new FormComponent( "com.formdev.flatlaf.themeeditor.FlatThemePreviewFonts$FontPreview" ) { + name: "largePreview" + "fontType": "Large" + "fontStyle": "large" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 0 8,gapx 12" + } ) + add( new FormComponent( "com.formdev.flatlaf.themeeditor.FlatThemePreviewFonts$FontPreview" ) { + name: "defaultPreview" + "fontType": "Default" + auxiliary() { + "JavaCodeGenerator.variableLocal": false + } + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 0 9,gapx 12" + } ) + add( new FormComponent( "com.formdev.flatlaf.themeeditor.FlatThemePreviewFonts$FontPreview" ) { + name: "mediumPreview" + "fontType": "Medium" + "fontStyle": "medium" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 0 10,gapx 12" + } ) + add( new FormComponent( "com.formdev.flatlaf.themeeditor.FlatThemePreviewFonts$FontPreview" ) { + name: "smallPreview" + "fontType": "Small" + "fontStyle": "small" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 0 11,gapx 12" + } ) + add( new FormComponent( "com.formdev.flatlaf.themeeditor.FlatThemePreviewFonts$FontPreview" ) { + name: "miniPreview" + "fontType": "Mini" + "fontStyle": "mini" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 0 12,gapx 12" + } ) + add( new FormComponent( "com.formdev.flatlaf.themeeditor.FlatThemePreviewFonts$FontPreview" ) { + name: "monospacedPreview" + "fontType": "Monospaced" + "fontStyle": "monospaced" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 0 13,gapx 12" + } ) + add( new FormComponent( "javax.swing.JLabel" ) { + name: "scaleLabel" + "text": "Fonts are scaled by:" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 0 14,gapx 12" + } ) + add( new FormComponent( "javax.swing.JLabel" ) { + name: "scaleValueLabel" + "text": "1x" + "$client.FlatLaf.styleClass": "h2" + auxiliary() { + "JavaCodeGenerator.variableLocal": false + } + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 0 14" + } ) + }, new FormLayoutConstraints( null ) { + "location": new java.awt.Point( 5, 0 ) + "size": new java.awt.Dimension( 335, 405 ) + } ) + add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) { + "$layoutConstraints": "insets 0,hidemode 3" + "$columnConstraints": "[90,left][fill]" + "$rowConstraints": "[]0" + } ) { + name: "panel1" + auxiliary() { + "JavaCodeGenerator.className": "FontPreview" + "JavaCodeGenerator.variableName": "fontPreview" + } + add( new FormComponent( "javax.swing.JLabel" ) { + name: "previewLabel" + "text": "preview" + auxiliary() { + "JavaCodeGenerator.variableLocal": false + } + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 0 0" + } ) + add( new FormComponent( "javax.swing.JLabel" ) { + name: "descLabel" + "text": "description" + "$client.FlatLaf.styleClass": "medium" + auxiliary() { + "JavaCodeGenerator.variableLocal": false + } + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 1 0" + } ) + }, new FormLayoutConstraints( null ) { + "location": new java.awt.Point( 5, 435 ) + "size": new java.awt.Dimension( 235, 65 ) + } ) + } +} From 587f431ef477a4ee51a3700d1bf18691870f928b Mon Sep 17 00:00:00 2001 From: Karl Tauber Date: Sat, 16 Oct 2021 18:56:53 +0200 Subject: [PATCH 08/22] Typography: added FlatFontsTest to quickly view all available fonts on the current system --- .../flatlaf/testing/FlatFontsTest.java | 242 ++++++++++++++++++ .../formdev/flatlaf/testing/FlatFontsTest.jfd | 103 ++++++++ 2 files changed, 345 insertions(+) create mode 100644 flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatFontsTest.java create mode 100644 flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatFontsTest.jfd 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 new file mode 100644 index 00000000..fb751888 --- /dev/null +++ b/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatFontsTest.java @@ -0,0 +1,242 @@ +/* + * Copyright 2021 FormDev Software GmbH + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.formdev.flatlaf.testing; + +import java.awt.Color; +import java.awt.Component; +import java.awt.Font; +import java.awt.GraphicsEnvironment; +import java.util.Map; +import java.util.TreeMap; +import javax.swing.*; +import com.formdev.flatlaf.util.UIScale; +import net.miginfocom.swing.*; + +/** + * @author Karl Tauber + */ +public class FlatFontsTest + extends JPanel +{ + public static void main( String[] args ) { + SwingUtilities.invokeLater( () -> { + FlatTestFrame frame = FlatTestFrame.create( args, "FlatFontsTest" ); + frame.showFrame( FlatFontsTest::new ); + } ); + } + + FlatFontsTest() { + initComponents(); + + Font[] allFonts = GraphicsEnvironment.getLocalGraphicsEnvironment().getAllFonts(); + + TreeMap> familiesMap = new TreeMap<>(); + for( Font font : allFonts ) { + TreeMap familyFontsMap = familiesMap.computeIfAbsent( font.getFamily(), key -> new TreeMap<>() ); + Font old = familyFontsMap.put( font.getName(), font ); + if( old != null ) { + System.err.println( "Duplicate font name '" + font.getName() + "'" ); + System.err.println( " " + old ); + System.err.println( " " + font ); + } + } + + DefaultListModel model = new DefaultListModel<>(); + for( Map.Entry> e : familiesMap.entrySet() ) { + FontFamilyInfo info = new FontFamilyInfo(); + info.name = e.getKey(); + info.fonts = e.getValue(); + model.addElement( info ); + } + familiesList.setModel( model ); + familiesList.setCellRenderer( new FontFamilyRenderer() ); + familiesList.setSelectedIndex( 0 ); + + SwingUtilities.invokeLater( () -> { + SwingUtilities.invokeLater( () -> { + familiesList.requestFocusInWindow(); + } ); + } ); + } + + private void familyChanged() { + previewFamilyNameLabel.setText( "" ); + previewPanel.removeAll(); + + FontFamilyInfo info = familiesList.getSelectedValue(); + if( info == null ) + return; + + previewFamilyNameLabel.setText( info.name ); + + for( Map.Entry e : info.fonts.entrySet() ) { + JLabel label = new JLabel( e.getKey() ); + label.setFont( e.getValue().deriveFont( (float) UIScale.scale( 36 ) ) ); + previewPanel.add( label, "wrap" ); + } + + previewPanel.revalidate(); + previewPanel.repaint(); + } + + private void initComponents() { + // JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents + JLabel familiesLabel = new JLabel(); + previewFamilyNameLabel = new JLabel(); + JScrollPane familiesScrollPane = new JScrollPane(); + familiesList = new JList<>(); + JSeparator separator1 = new JSeparator(); + JScrollPane scrollPane1 = new JScrollPane(); + previewPanel = new JPanel(); + + //======== this ======== + setBorder(null); + setLayout(new MigLayout( + "insets dialog,hidemode 3", + // columns + "[230:230,fill]para" + + "[grow,fill]", + // rows + "[top]" + + "[]" + + "[]" + + "[800,grow,fill]")); + + //---- familiesLabel ---- + familiesLabel.setText("Families:"); + add(familiesLabel, "cell 0 0"); + + //---- previewFamilyNameLabel ---- + previewFamilyNameLabel.setText("name"); + previewFamilyNameLabel.putClientProperty("FlatLaf.styleClass", "h1"); + add(previewFamilyNameLabel, "cell 1 1"); + + //======== familiesScrollPane ======== + { + + //---- familiesList ---- + familiesList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); + familiesList.addListSelectionListener(e -> familyChanged()); + familiesScrollPane.setViewportView(familiesList); + } + add(familiesScrollPane, "cell 0 1 1 3,growy"); + add(separator1, "cell 1 2"); + + //======== scrollPane1 ======== + { + scrollPane1.setBorder(BorderFactory.createEmptyBorder()); + + //======== previewPanel ======== + { + previewPanel.setLayout(new MigLayout( + "insets dialog,hidemode 3", + // columns + "[fill]", + // rows + "[]")); + } + scrollPane1.setViewportView(previewPanel); + } + add(scrollPane1, "cell 1 3"); + // JFormDesigner - End of component initialization //GEN-END:initComponents + } + + // JFormDesigner - Variables declaration - DO NOT MODIFY //GEN-BEGIN:variables + private JLabel previewFamilyNameLabel; + private JList familiesList; + private JPanel previewPanel; + // JFormDesigner - End of variables declaration //GEN-END:variables + + //---- class FontFamilyInfo ----------------------------------------------- + + private static class FontFamilyInfo + { + String name; + TreeMap fonts; + } + + //---- class FontFamilyRenderer ------------------------------------------- + + private static class FontFamilyRenderer + extends JPanel + implements ListCellRenderer + { + private FontFamilyRenderer() { + initComponents(); + } + + @Override + public Component getListCellRendererComponent( JList list, + FontFamilyInfo value, int index, boolean isSelected, boolean cellHasFocus ) + { + String family = value.name; + StringBuilder buf = new StringBuilder(); + for( String key : value.fonts.keySet() ) { + if( key.startsWith( family ) ) { + key = key.substring( family.length() ).trim(); + if( key.isEmpty() ) + key = "Regular"; + } + if( buf.length() > 0 ) + buf.append( ", " ); + buf.append( key ); + } + + familyNameLabel.setText( family ); + familyDescriptionLabel.setText( buf.toString() ); + + familyNameLabel.setFont( UIManager.getFont( "large.font" ) ); + familyDescriptionLabel.setFont( UIManager.getFont( "small.font" ) ); + familyDescriptionLabel.setEnabled( isSelected ); + + setBackground( isSelected ? list.getSelectionBackground() : list.getBackground() ); + Color fg = isSelected ? list.getSelectionForeground() : list.getForeground(); + familyNameLabel.setForeground( fg ); + familyDescriptionLabel.setForeground( fg ); + return this; + } + + private void initComponents() { + // JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents + familyNameLabel = new JLabel(); + familyDescriptionLabel = new JLabel(); + + //======== this ======== + setLayout(new MigLayout( + "insets 2 6 2 6,hidemode 3", + // columns + "[fill]", + // rows + "[]0" + + "[]")); + + //---- familyNameLabel ---- + familyNameLabel.setText("text"); + add(familyNameLabel, "cell 0 0"); + + //---- familyDescriptionLabel ---- + familyDescriptionLabel.setText("text"); + add(familyDescriptionLabel, "cell 0 1"); + // JFormDesigner - End of component initialization //GEN-END:initComponents + } + + // JFormDesigner - Variables declaration - DO NOT MODIFY //GEN-BEGIN:variables + private JLabel familyNameLabel; + private JLabel familyDescriptionLabel; + // JFormDesigner - End of variables declaration //GEN-END:variables + } +} diff --git a/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatFontsTest.jfd b/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatFontsTest.jfd new file mode 100644 index 00000000..36672ba8 --- /dev/null +++ b/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatFontsTest.jfd @@ -0,0 +1,103 @@ +JFDML JFormDesigner: "7.0.5.0.382" Java: "16" encoding: "UTF-8" + +new FormModel { + contentType: "form/swing" + root: new FormRoot { + auxiliary() { + "JavaCodeGenerator.defaultVariableLocal": true + } + add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) { + "$layoutConstraints": "insets dialog,hidemode 3" + "$columnConstraints": "[230:230,fill]para[grow,fill]" + "$rowConstraints": "[top][][][800,grow,fill]" + } ) { + name: "this" + "border": sfield com.jformdesigner.model.FormObject NULL_VALUE + add( new FormComponent( "javax.swing.JLabel" ) { + name: "familiesLabel" + "text": "Families:" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 0 0" + } ) + add( new FormComponent( "javax.swing.JLabel" ) { + name: "previewFamilyNameLabel" + "text": "name" + "$client.FlatLaf.styleClass": "h1" + auxiliary() { + "JavaCodeGenerator.variableLocal": false + } + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 1 1" + } ) + add( new FormContainer( "javax.swing.JScrollPane", new FormLayoutManager( class javax.swing.JScrollPane ) ) { + name: "familiesScrollPane" + add( new FormComponent( "javax.swing.JList" ) { + name: "familiesList" + "selectionMode": 0 + auxiliary() { + "JavaCodeGenerator.variableLocal": false + "JavaCodeGenerator.typeParameters": "FontFamilyInfo" + } + addEvent( new FormEvent( "javax.swing.event.ListSelectionListener", "valueChanged", "familyChanged", false ) ) + } ) + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 0 1 1 3,growy" + } ) + add( new FormComponent( "javax.swing.JSeparator" ) { + name: "separator1" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 1 2" + } ) + add( new FormContainer( "javax.swing.JScrollPane", new FormLayoutManager( class javax.swing.JScrollPane ) ) { + name: "scrollPane1" + "border": new javax.swing.border.EmptyBorder( 0, 0, 0, 0 ) + add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) { + "$layoutConstraints": "insets dialog,hidemode 3" + "$columnConstraints": "[fill]" + "$rowConstraints": "[]" + } ) { + name: "previewPanel" + auxiliary() { + "JavaCodeGenerator.variableLocal": false + } + } ) + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 1 3" + } ) + }, new FormLayoutConstraints( null ) { + "location": new java.awt.Point( 0, 0 ) + "size": new java.awt.Dimension( 450, 300 ) + } ) + add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) { + "$layoutConstraints": "insets 2 6 2 6,hidemode 3" + "$columnConstraints": "[fill]" + "$rowConstraints": "[]0[]" + } ) { + name: "panel1" + auxiliary() { + "JavaCodeGenerator.className": "FontFamilyRenderer" + } + add( new FormComponent( "javax.swing.JLabel" ) { + name: "familyNameLabel" + "text": "text" + auxiliary() { + "JavaCodeGenerator.variableLocal": false + } + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 0 0" + } ) + add( new FormComponent( "javax.swing.JLabel" ) { + name: "familyDescriptionLabel" + "text": "text" + auxiliary() { + "JavaCodeGenerator.variableLocal": false + } + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 0 1" + } ) + }, new FormLayoutConstraints( null ) { + "location": new java.awt.Point( 0, 330 ) + "size": new java.awt.Dimension( 255, 105 ) + } ) + } +} From 80f51bfe1ea3974aae9d47d87ee29544af0c5284 Mon Sep 17 00:00:00 2001 From: Karl Tauber Date: Sun, 17 Oct 2021 14:43:12 +0200 Subject: [PATCH 09/22] Theme Editor: fixed StackOverflowError when setting "defaultFont" to non-font value (e.g. `defaultFont = #fff`) --- .../formdev/flatlaf/themeeditor/FlatThemePreview.java | 11 +++++++++-- .../flatlaf/themeeditor/FlatThemePreviewFonts.java | 2 +- 2 files changed, 10 insertions(+), 3 deletions(-) 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 355fbf7c..6e47a250 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 @@ -177,7 +177,8 @@ class FlatThemePreview Object value = textArea.propertiesSupport.getParsedProperty( (String) key ); - inGetDefaultFont = "defaultFont".equals( key ); + boolean isDefaultFont = "defaultFont".equals( key ); + inGetDefaultFont = isDefaultFont; try { if( value instanceof LazyValue ) { value = lazyValueCache.computeIfAbsent( (LazyValue) value, k -> { @@ -191,6 +192,12 @@ class FlatThemePreview // System.out.println( key + " = " + value ); + // for "defaultFont" never return a value that is not a font + // (e.g. a color for "defaultFont = #fff") to avoid StackOverflowError + // in Active.createValue() + if( isDefaultFont && !(value instanceof Font) ) + return null; + // If value is null and is a property that is defined in a core theme, // then force the value to null. // This is necessary for cases where the current application Laf defines a property @@ -198,7 +205,7 @@ class FlatThemePreview // E.g. FlatLightLaf defines Button.focusedBackground, but in FlatDarkLaf // it is not defined. Without this code, the preview for FlatDarkLaf would use // Button.focusedBackground from FlatLightLaf if FlatLightLaf is the current application Laf. - if( value == null && FlatThemePropertiesBaseManager.getDefindedCoreKeys().contains( key ) && !"defaultFont".equals( key ) ) + if( value == null && FlatThemePropertiesBaseManager.getDefindedCoreKeys().contains( key ) && !isDefaultFont ) return FlatLaf.NULL_VALUE; return value; 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 88385b6c..55bf3cab 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 @@ -177,7 +177,7 @@ public class FlatThemePreviewFonts updateDescription( previewLabel.getFont() ); previewLabel.addPropertyChangeListener( "font", e -> { - updateDescription( (Font) e.getNewValue() ); + updateDescription( previewLabel.getFont() ); } ); } From 80297f113fe58e68729c1430859d0c46a79ddd17 Mon Sep 17 00:00:00 2001 From: Karl Tauber Date: Sun, 17 Oct 2021 14:59:18 +0200 Subject: [PATCH 10/22] UIDefaultsLoader: detect string values, that start and end with '"', after determining value type from key to allow font values like `"Roboto Mono"` --- .../java/com/formdev/flatlaf/UIDefaultsLoader.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/flatlaf-core/src/main/java/com/formdev/flatlaf/UIDefaultsLoader.java b/flatlaf-core/src/main/java/com/formdev/flatlaf/UIDefaultsLoader.java index b8133be7..95544e59 100644 --- a/flatlaf-core/src/main/java/com/formdev/flatlaf/UIDefaultsLoader.java +++ b/flatlaf-core/src/main/java/com/formdev/flatlaf/UIDefaultsLoader.java @@ -410,10 +410,7 @@ class UIDefaultsLoader // check whether value type is specified in the value if( value.startsWith( "#" ) ) valueType = ValueType.COLOR; - else if( value.startsWith( "\"" ) && value.indexOf( '"', 1 ) == value.length() - 1 ) { - valueType = ValueType.STRING; - value = value.substring( 1, value.length() - 1 ); - } else if( value.startsWith( TYPE_PREFIX ) ) { + else if( value.startsWith( TYPE_PREFIX ) ) { int end = value.indexOf( TYPE_PREFIX_END ); if( end != -1 ) { try { @@ -482,6 +479,12 @@ class UIDefaultsLoader case GRAYFILTER: return parseGrayFilter( value ); case UNKNOWN: default: + // string + if( value.startsWith( "\"" ) && value.endsWith( "\"" ) ) { + resultValueType[0] = ValueType.STRING; + return value.substring( 1, value.length() - 1 ); + } + // colors Object color = parseColorOrFunction( value, resolver, false ); if( color != null ) { From d34619824c9cdef2b2f37fc70187e2982d47ed60 Mon Sep 17 00:00:00 2001 From: Karl Tauber Date: Sun, 17 Oct 2021 16:54:05 +0200 Subject: [PATCH 11/22] Typography: support deriving font from any other font (was always from defaultFont) (issue #384) --- .../java/com/formdev/flatlaf/FlatLaf.java | 40 ++++++++++++++----- .../com/formdev/flatlaf/UIDefaultsLoader.java | 13 ++++-- 2 files changed, 39 insertions(+), 14 deletions(-) diff --git a/flatlaf-core/src/main/java/com/formdev/flatlaf/FlatLaf.java b/flatlaf-core/src/main/java/com/formdev/flatlaf/FlatLaf.java index f5311895..a78f4a1e 100644 --- a/flatlaf-core/src/main/java/com/formdev/flatlaf/FlatLaf.java +++ b/flatlaf-core/src/main/java/com/formdev/flatlaf/FlatLaf.java @@ -527,7 +527,7 @@ public abstract class FlatLaf // use active value for all fonts to allow changing fonts in all components with: // UIManager.put( "defaultFont", myFont ); // (this is similar as in Nimbus L&F) - Object activeFont = new ActiveFont( null, -1, 0, 0, 0, 0 ); + Object activeFont = new ActiveFont( null, null, -1, 0, 0, 0, 0 ); // override fonts for( Object key : defaults.keySet() ) { @@ -611,7 +611,7 @@ public abstract class FlatLaf /** @since 1.1 */ public static ActiveValue createActiveFontValue( float scaleFactor ) { - return new ActiveFont( null, -1, 0, 0, 0, scaleFactor ); + return new ActiveFont( null, null, -1, 0, 0, 0, scaleFactor ); } /** @@ -1182,6 +1182,7 @@ public abstract class FlatLaf static class ActiveFont implements ActiveValue { + private final String baseFontKey; private final List families; private final int style; private final int styleChange; @@ -1191,7 +1192,9 @@ public abstract class FlatLaf // cache (scaled/derived) font private FontUIResource font; - private Font lastDefaultFont; + private Font lastBaseFont; + + private boolean inCreateValue; /** * @param families list of font families, or {@code null} @@ -1202,9 +1205,10 @@ public abstract class FlatLaf * @param relativeSize added to size of base font, or {@code 0} * @param scaleSize multiply size of base font, or {@code 0} */ - ActiveFont( List families, int style, int styleChange, + ActiveFont( String baseFontKey, List families, int style, int styleChange, int absoluteSize, int relativeSize, float scaleSize ) { + this.baseFontKey = baseFontKey; this.families = families; this.style = style; this.styleChange = styleChange; @@ -1215,16 +1219,30 @@ public abstract class FlatLaf @Override public Object createValue( UIDefaults table ) { - Font defaultFont = UIManager.getFont( "defaultFont" ); + if( inCreateValue ) + throw new IllegalStateException( "FlatLaf: endless recursion in font" ); - // fallback (to avoid NPE in case that this is used in another Laf) - if( defaultFont == null ) - defaultFont = UIManager.getFont( "Label.font" ); + Font baseFont = null; - if( lastDefaultFont != defaultFont ) { - lastDefaultFont = defaultFont; + inCreateValue = true; + try { + if( baseFontKey != null ) + baseFont = (Font) UIDefaultsLoader.lazyUIManagerGet( baseFontKey ); - font = derive( defaultFont, fontSize -> UIScale.scale( fontSize ) ); + if( baseFont == null ) + baseFont = UIManager.getFont( "defaultFont" ); + + // fallback (to avoid NPE in case that this is used in another Laf) + if( baseFont == null ) + baseFont = UIManager.getFont( "Label.font" ); + } finally { + inCreateValue = false; + } + + if( lastBaseFont != baseFont ) { + lastBaseFont = baseFont; + + font = derive( baseFont, fontSize -> UIScale.scale( fontSize ) ); } return font; diff --git a/flatlaf-core/src/main/java/com/formdev/flatlaf/UIDefaultsLoader.java b/flatlaf-core/src/main/java/com/formdev/flatlaf/UIDefaultsLoader.java index 95544e59..01b93eb6 100644 --- a/flatlaf-core/src/main/java/com/formdev/flatlaf/UIDefaultsLoader.java +++ b/flatlaf-core/src/main/java/com/formdev/flatlaf/UIDefaultsLoader.java @@ -1000,7 +1000,7 @@ class UIDefaultsLoader } /** - * Syntax: [normal] [bold|+bold|-bold] [italic|+italic|-italic] [|+|-|%] [family[, family]] + * Syntax: [normal] [bold|+bold|-bold] [italic|+italic|-italic] [|+|-|%] [family[, family]] [$baseFontKey] */ private static Object parseFont( String value ) { Object font = fontCache.get( value ); @@ -1013,6 +1013,7 @@ class UIDefaultsLoader int relativeSize = 0; float scaleSize = 0; List families = null; + String baseFontKey = null; // use StreamTokenizer to split string because it supports quoted strings StreamTokenizer st = new StreamTokenizer( new StringReader( value ) ); @@ -1062,6 +1063,12 @@ class UIDefaultsLoader scaleSize = parseInteger( param.substring( 0, param.length() - 1 ), true ) / 100f; else absoluteSize = parseInteger( param, true ); + } else if( firstChar == '$' ) { + // reference to base font + if( baseFontKey != null ) + throw new IllegalArgumentException( "baseFontKey specified more than once in '" + value + "'" ); + + baseFontKey = param.substring( 1 ); } else { // font family if( families == null ) @@ -1088,7 +1095,7 @@ class UIDefaultsLoader throw new IllegalArgumentException( "can not use '+italic' and '-italic' in '" + value + "'" ); } - font = new FlatLaf.ActiveFont( families, style, styleChange, absoluteSize, relativeSize, scaleSize ); + font = new FlatLaf.ActiveFont( baseFontKey, families, style, styleChange, absoluteSize, relativeSize, scaleSize ); fontCache.put( value, font ); return font; } @@ -1227,7 +1234,7 @@ class UIDefaultsLoader * For use in LazyValue to get value for given key from UIManager and report error * if not found. If key is prefixed by '?', then no error is reported. */ - private static Object lazyUIManagerGet( String uiKey ) { + static Object lazyUIManagerGet( String uiKey ) { boolean optional = false; if( uiKey.startsWith( OPTIONAL_PREFIX ) ) { uiKey = uiKey.substring( OPTIONAL_PREFIX.length() ); From 7c594ba7a9682b6aafa9566ee3bd01fc6f11cf2d Mon Sep 17 00:00:00 2001 From: Karl Tauber Date: Mon, 25 Oct 2021 13:06:34 +0200 Subject: [PATCH 12/22] Typography: UIDefaultsDump: dumps updated on macOS Big Sur --- .../uidefaults/FlatDarkLaf_1.8.0_202-mac.txt | 97 ++++++++++++++++++- .../uidefaults/FlatLightLaf_1.8.0_202-mac.txt | 97 ++++++++++++++++++- .../testing/uidefaults/UIDefaultsDump.java | 2 + 3 files changed, 190 insertions(+), 6 deletions(-) diff --git a/flatlaf-testing/dumps/uidefaults/FlatDarkLaf_1.8.0_202-mac.txt b/flatlaf-testing/dumps/uidefaults/FlatDarkLaf_1.8.0_202-mac.txt index ca6fa9ba..7c003eb4 100644 --- a/flatlaf-testing/dumps/uidefaults/FlatDarkLaf_1.8.0_202-mac.txt +++ b/flatlaf-testing/dumps/uidefaults/FlatDarkLaf_1.8.0_202-mac.txt @@ -1,20 +1,46 @@ +- Java 1.8.0_202 ++ Java 1.8.0_292 + - OS Windows 10 + OS Mac OS X +#---- ComboBox ---- + + ComboBox.showPopupOnNavigation true + +#---- FileChooser ---- + +- FileChooser.useSystemExtensionHiding true ++ FileChooser.useSystemExtensionHiding false + + +#---- Menu ---- + - Menu.shortcutKeys length=1 [I [0] 8 + Menu.shortcutKeys length=1 [I [0] 10 + +#---- MenuItem ---- + - MenuItem.acceleratorDelimiter - + MenuItem.acceleratorDelimiter + +#---- OptionPane ---- + + OptionPane.isYesLast true + +#---- ProgressBar ---- + - ProgressBar.font [active] Segoe UI plain 10 javax.swing.plaf.FontUIResource [UI] -+ ProgressBar.font [active] .SF NS Text plain 11 javax.swing.plaf.FontUIResource [UI] ++ ProgressBar.font [active] Helvetica Neue plain 11 javax.swing.plaf.FontUIResource [UI] + + +#---- ScrollBar ---- - ScrollBar.hoverThumbWithTrack false + ScrollBar.hoverThumbWithTrack true @@ -27,7 +53,72 @@ - ScrollBar.thumbInsets 0,0,0,0 javax.swing.plaf.InsetsUIResource [UI] + ScrollBar.thumbInsets 2,2,2,2 javax.swing.plaf.InsetsUIResource [UI] - - defaultFont Segoe UI plain 12 javax.swing.plaf.FontUIResource [UI] -+ defaultFont .SF NS Text plain 13 javax.swing.plaf.FontUIResource [UI] ++ defaultFont Helvetica Neue plain 13 javax.swing.plaf.FontUIResource [UI] + + +#---- h0 ---- + +- h0.font [active] Segoe UI plain 30 javax.swing.plaf.FontUIResource [UI] ++ h0.font [active] Helvetica Neue plain 31 javax.swing.plaf.FontUIResource [UI] + + +#---- h00 ---- + +- h00.font [active] Segoe UI plain 36 javax.swing.plaf.FontUIResource [UI] ++ h00.font [active] Helvetica Neue plain 37 javax.swing.plaf.FontUIResource [UI] + + +#---- h1 ---- + +- h1.font [active] Segoe UI plain 24 javax.swing.plaf.FontUIResource [UI] ++ h1.font [active] Helvetica Neue plain 25 javax.swing.plaf.FontUIResource [UI] + + +#---- h2 ---- + +- h2.font [active] Segoe UI plain 18 javax.swing.plaf.FontUIResource [UI] ++ h2.font [active] Helvetica Neue plain 19 javax.swing.plaf.FontUIResource [UI] + + +#---- h3 ---- + +- h3.font [active] Segoe UI plain 15 javax.swing.plaf.FontUIResource [UI] ++ h3.font [active] Helvetica Neue plain 16 javax.swing.plaf.FontUIResource [UI] + + +#---- h4 ---- + +- h4.font [active] Segoe UI bold 12 javax.swing.plaf.FontUIResource [UI] ++ h4.font [active] Helvetica Neue bold 13 javax.swing.plaf.FontUIResource [UI] + + +#---- large ---- + +- large.font [active] Segoe UI plain 14 javax.swing.plaf.FontUIResource [UI] ++ large.font [active] Helvetica Neue plain 15 javax.swing.plaf.FontUIResource [UI] + + +#---- medium ---- + +- medium.font [active] Segoe UI plain 11 javax.swing.plaf.FontUIResource [UI] ++ medium.font [active] Helvetica Neue plain 12 javax.swing.plaf.FontUIResource [UI] + + +#---- mini ---- + +- mini.font [active] Segoe UI plain 9 javax.swing.plaf.FontUIResource [UI] ++ mini.font [active] Helvetica Neue plain 10 javax.swing.plaf.FontUIResource [UI] + + +#---- monospaced ---- + +- monospaced.font [active] Consolas plain 12 javax.swing.plaf.FontUIResource [UI] ++ monospaced.font [active] Menlo plain 13 javax.swing.plaf.FontUIResource [UI] + + +#---- small ---- + +- small.font [active] Segoe UI plain 10 javax.swing.plaf.FontUIResource [UI] ++ small.font [active] Helvetica Neue plain 11 javax.swing.plaf.FontUIResource [UI] diff --git a/flatlaf-testing/dumps/uidefaults/FlatLightLaf_1.8.0_202-mac.txt b/flatlaf-testing/dumps/uidefaults/FlatLightLaf_1.8.0_202-mac.txt index ca6fa9ba..7c003eb4 100644 --- a/flatlaf-testing/dumps/uidefaults/FlatLightLaf_1.8.0_202-mac.txt +++ b/flatlaf-testing/dumps/uidefaults/FlatLightLaf_1.8.0_202-mac.txt @@ -1,20 +1,46 @@ +- Java 1.8.0_202 ++ Java 1.8.0_292 + - OS Windows 10 + OS Mac OS X +#---- ComboBox ---- + + ComboBox.showPopupOnNavigation true + +#---- FileChooser ---- + +- FileChooser.useSystemExtensionHiding true ++ FileChooser.useSystemExtensionHiding false + + +#---- Menu ---- + - Menu.shortcutKeys length=1 [I [0] 8 + Menu.shortcutKeys length=1 [I [0] 10 + +#---- MenuItem ---- + - MenuItem.acceleratorDelimiter - + MenuItem.acceleratorDelimiter + +#---- OptionPane ---- + + OptionPane.isYesLast true + +#---- ProgressBar ---- + - ProgressBar.font [active] Segoe UI plain 10 javax.swing.plaf.FontUIResource [UI] -+ ProgressBar.font [active] .SF NS Text plain 11 javax.swing.plaf.FontUIResource [UI] ++ ProgressBar.font [active] Helvetica Neue plain 11 javax.swing.plaf.FontUIResource [UI] + + +#---- ScrollBar ---- - ScrollBar.hoverThumbWithTrack false + ScrollBar.hoverThumbWithTrack true @@ -27,7 +53,72 @@ - ScrollBar.thumbInsets 0,0,0,0 javax.swing.plaf.InsetsUIResource [UI] + ScrollBar.thumbInsets 2,2,2,2 javax.swing.plaf.InsetsUIResource [UI] - - defaultFont Segoe UI plain 12 javax.swing.plaf.FontUIResource [UI] -+ defaultFont .SF NS Text plain 13 javax.swing.plaf.FontUIResource [UI] ++ defaultFont Helvetica Neue plain 13 javax.swing.plaf.FontUIResource [UI] + + +#---- h0 ---- + +- h0.font [active] Segoe UI plain 30 javax.swing.plaf.FontUIResource [UI] ++ h0.font [active] Helvetica Neue plain 31 javax.swing.plaf.FontUIResource [UI] + + +#---- h00 ---- + +- h00.font [active] Segoe UI plain 36 javax.swing.plaf.FontUIResource [UI] ++ h00.font [active] Helvetica Neue plain 37 javax.swing.plaf.FontUIResource [UI] + + +#---- h1 ---- + +- h1.font [active] Segoe UI plain 24 javax.swing.plaf.FontUIResource [UI] ++ h1.font [active] Helvetica Neue plain 25 javax.swing.plaf.FontUIResource [UI] + + +#---- h2 ---- + +- h2.font [active] Segoe UI plain 18 javax.swing.plaf.FontUIResource [UI] ++ h2.font [active] Helvetica Neue plain 19 javax.swing.plaf.FontUIResource [UI] + + +#---- h3 ---- + +- h3.font [active] Segoe UI plain 15 javax.swing.plaf.FontUIResource [UI] ++ h3.font [active] Helvetica Neue plain 16 javax.swing.plaf.FontUIResource [UI] + + +#---- h4 ---- + +- h4.font [active] Segoe UI bold 12 javax.swing.plaf.FontUIResource [UI] ++ h4.font [active] Helvetica Neue bold 13 javax.swing.plaf.FontUIResource [UI] + + +#---- large ---- + +- large.font [active] Segoe UI plain 14 javax.swing.plaf.FontUIResource [UI] ++ large.font [active] Helvetica Neue plain 15 javax.swing.plaf.FontUIResource [UI] + + +#---- medium ---- + +- medium.font [active] Segoe UI plain 11 javax.swing.plaf.FontUIResource [UI] ++ medium.font [active] Helvetica Neue plain 12 javax.swing.plaf.FontUIResource [UI] + + +#---- mini ---- + +- mini.font [active] Segoe UI plain 9 javax.swing.plaf.FontUIResource [UI] ++ mini.font [active] Helvetica Neue plain 10 javax.swing.plaf.FontUIResource [UI] + + +#---- monospaced ---- + +- monospaced.font [active] Consolas plain 12 javax.swing.plaf.FontUIResource [UI] ++ monospaced.font [active] Menlo plain 13 javax.swing.plaf.FontUIResource [UI] + + +#---- small ---- + +- small.font [active] Segoe UI plain 10 javax.swing.plaf.FontUIResource [UI] ++ small.font [active] Helvetica Neue plain 11 javax.swing.plaf.FontUIResource [UI] diff --git a/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/uidefaults/UIDefaultsDump.java b/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/uidefaults/UIDefaultsDump.java index a1aa6b40..ef907538 100644 --- a/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/uidefaults/UIDefaultsDump.java +++ b/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/uidefaults/UIDefaultsDump.java @@ -199,6 +199,8 @@ public class UIDefaultsDump ? "-linux" : ""); String javaVersion = System.getProperty( "java.version" ); + if( javaVersion.startsWith( "1.8.0_" ) ) + javaVersion = "1.8.0_202"; File file = new File( dir, name + nameSuffix + "_" + javaVersion + osSuffix + ".txt" ); From e6e4e53a73b96f0a91ef9d39a4be8a5c950a793a Mon Sep 17 00:00:00 2001 From: Karl Tauber Date: Mon, 25 Oct 2021 13:27:40 +0200 Subject: [PATCH 13/22] Typography: added light and semibold font/style --- .../com/formdev/flatlaf/FlatLaf.properties | 16 ++++++++++++ .../uidefaults/FlatDarkLaf_1.8.0_202-mac.txt | 12 +++++++++ .../uidefaults/FlatDarkLaf_1.8.0_202.txt | 12 +++++++++ .../uidefaults/FlatLightLaf_1.8.0_202-mac.txt | 12 +++++++++ .../uidefaults/FlatLightLaf_1.8.0_202.txt | 12 +++++++++ .../themeeditor/FlatThemePreviewFonts.java | 20 +++++++++++--- .../themeeditor/FlatThemePreviewFonts.jfd | 26 ++++++++++++++----- .../flatlaf/themeeditor/FlatLafUIKeys.txt | 4 +++ 8 files changed, 105 insertions(+), 9 deletions(-) diff --git a/flatlaf-core/src/main/resources/com/formdev/flatlaf/FlatLaf.properties b/flatlaf-core/src/main/resources/com/formdev/flatlaf/FlatLaf.properties index b483ead4..4dafd803 100644 --- a/flatlaf-core/src/main/resources/com/formdev/flatlaf/FlatLaf.properties +++ b/flatlaf-core/src/main/resources/com/formdev/flatlaf/FlatLaf.properties @@ -45,6 +45,20 @@ mini.font = -3 # default font #defaultFont = ... +# font weights +# Windows +[win]light.font = "Segoe UI Light" +[win]semibold.font = "Segoe UI Semibold" +# macOS +[mac]light.font = "HelveticaNeue-Light" +[mac]semibold.font = "HelveticaNeue-Medium" +# Linux +[linux]light.font = "Lato Light", "Ubuntu Light", "Cantarell Light" +[linux]semibold.font = "Lato Semibold", "Ubuntu Medium" +# fallback for unknown platform +light.font = +0 +semibold.font = +0 + # monospaced [win]monospaced.font = Consolas, "Courier New", Monospaced [mac]monospaced.font = Menlo, Monospaced @@ -62,6 +76,8 @@ monospaced.font = Monospaced [style].medium = font: $medium.font [style].small = font: $small.font [style].mini = font: $mini.font +[style].light = font: $light.font +[style].semibold = font: $semibold.font [style].monospaced = font: $monospaced.font diff --git a/flatlaf-testing/dumps/uidefaults/FlatDarkLaf_1.8.0_202-mac.txt b/flatlaf-testing/dumps/uidefaults/FlatDarkLaf_1.8.0_202-mac.txt index 7c003eb4..18039343 100644 --- a/flatlaf-testing/dumps/uidefaults/FlatDarkLaf_1.8.0_202-mac.txt +++ b/flatlaf-testing/dumps/uidefaults/FlatDarkLaf_1.8.0_202-mac.txt @@ -100,6 +100,12 @@ + large.font [active] Helvetica Neue plain 15 javax.swing.plaf.FontUIResource [UI] +#---- light ---- + +- light.font [active] Segoe UI Light plain 12 javax.swing.plaf.FontUIResource [UI] ++ light.font [active] HelveticaNeue-Light plain 13 javax.swing.plaf.FontUIResource [UI] + + #---- medium ---- - medium.font [active] Segoe UI plain 11 javax.swing.plaf.FontUIResource [UI] @@ -118,6 +124,12 @@ + monospaced.font [active] Menlo plain 13 javax.swing.plaf.FontUIResource [UI] +#---- semibold ---- + +- semibold.font [active] Segoe UI Semibold plain 12 javax.swing.plaf.FontUIResource [UI] ++ semibold.font [active] HelveticaNeue-Medium plain 13 javax.swing.plaf.FontUIResource [UI] + + #---- small ---- - small.font [active] Segoe UI plain 10 javax.swing.plaf.FontUIResource [UI] diff --git a/flatlaf-testing/dumps/uidefaults/FlatDarkLaf_1.8.0_202.txt b/flatlaf-testing/dumps/uidefaults/FlatDarkLaf_1.8.0_202.txt index fb98341a..4d706a84 100644 --- a/flatlaf-testing/dumps/uidefaults/FlatDarkLaf_1.8.0_202.txt +++ b/flatlaf-testing/dumps/uidefaults/FlatDarkLaf_1.8.0_202.txt @@ -1390,9 +1390,11 @@ ViewportUI com.formdev.flatlaf.ui.FlatViewportUI [style].h3 font: $h3.font [style].h4 font: $h4.font [style].large font: $large.font +[style].light font: $light.font [style].medium font: $medium.font [style].mini font: $mini.font [style].monospaced font: $monospaced.font +[style].semibold font: $semibold.font [style].small font: $small.font @@ -1467,6 +1469,11 @@ laf.scaleFactor [active] 1.0 large.font [active] Segoe UI plain 14 javax.swing.plaf.FontUIResource [UI] +#---- light ---- + +light.font [active] Segoe UI Light plain 12 javax.swing.plaf.FontUIResource [UI] + + #---- medium ---- medium.font [active] Segoe UI plain 11 javax.swing.plaf.FontUIResource [UI] @@ -1493,6 +1500,11 @@ monospaced.font [active] Consolas plain 12 javax.swing.plaf.Fo scrollbar #3e4244 HSL 200 5 25 com.formdev.flatlaf.util.DerivedColor [UI] lighten(1%) +#---- semibold ---- + +semibold.font [active] Segoe UI Semibold plain 12 javax.swing.plaf.FontUIResource [UI] + + #---- small ---- small.font [active] Segoe UI plain 10 javax.swing.plaf.FontUIResource [UI] diff --git a/flatlaf-testing/dumps/uidefaults/FlatLightLaf_1.8.0_202-mac.txt b/flatlaf-testing/dumps/uidefaults/FlatLightLaf_1.8.0_202-mac.txt index 7c003eb4..18039343 100644 --- a/flatlaf-testing/dumps/uidefaults/FlatLightLaf_1.8.0_202-mac.txt +++ b/flatlaf-testing/dumps/uidefaults/FlatLightLaf_1.8.0_202-mac.txt @@ -100,6 +100,12 @@ + large.font [active] Helvetica Neue plain 15 javax.swing.plaf.FontUIResource [UI] +#---- light ---- + +- light.font [active] Segoe UI Light plain 12 javax.swing.plaf.FontUIResource [UI] ++ light.font [active] HelveticaNeue-Light plain 13 javax.swing.plaf.FontUIResource [UI] + + #---- medium ---- - medium.font [active] Segoe UI plain 11 javax.swing.plaf.FontUIResource [UI] @@ -118,6 +124,12 @@ + monospaced.font [active] Menlo plain 13 javax.swing.plaf.FontUIResource [UI] +#---- semibold ---- + +- semibold.font [active] Segoe UI Semibold plain 12 javax.swing.plaf.FontUIResource [UI] ++ semibold.font [active] HelveticaNeue-Medium plain 13 javax.swing.plaf.FontUIResource [UI] + + #---- small ---- - small.font [active] Segoe UI plain 10 javax.swing.plaf.FontUIResource [UI] diff --git a/flatlaf-testing/dumps/uidefaults/FlatLightLaf_1.8.0_202.txt b/flatlaf-testing/dumps/uidefaults/FlatLightLaf_1.8.0_202.txt index 4e136ebd..f6748391 100644 --- a/flatlaf-testing/dumps/uidefaults/FlatLightLaf_1.8.0_202.txt +++ b/flatlaf-testing/dumps/uidefaults/FlatLightLaf_1.8.0_202.txt @@ -1395,9 +1395,11 @@ ViewportUI com.formdev.flatlaf.ui.FlatViewportUI [style].h3 font: $h3.font [style].h4 font: $h4.font [style].large font: $large.font +[style].light font: $light.font [style].medium font: $medium.font [style].mini font: $mini.font [style].monospaced font: $monospaced.font +[style].semibold font: $semibold.font [style].small font: $small.font @@ -1472,6 +1474,11 @@ laf.scaleFactor [active] 1.0 large.font [active] Segoe UI plain 14 javax.swing.plaf.FontUIResource [UI] +#---- light ---- + +light.font [active] Segoe UI Light plain 12 javax.swing.plaf.FontUIResource [UI] + + #---- medium ---- medium.font [active] Segoe UI plain 11 javax.swing.plaf.FontUIResource [UI] @@ -1498,6 +1505,11 @@ monospaced.font [active] Consolas plain 12 javax.swing.plaf.Fo scrollbar #f5f5f5 HSL 0 0 96 com.formdev.flatlaf.util.DerivedColor [UI] lighten(1%) +#---- semibold ---- + +semibold.font [active] Segoe UI Semibold plain 12 javax.swing.plaf.FontUIResource [UI] + + #---- small ---- small.font [active] Segoe UI plain 10 javax.swing.plaf.FontUIResource [UI] 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 55bf3cab..9a8d2510 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 @@ -53,6 +53,8 @@ public class FlatThemePreviewFonts FlatThemePreviewFonts.FontPreview mediumPreview = new FlatThemePreviewFonts.FontPreview(); FlatThemePreviewFonts.FontPreview smallPreview = new FlatThemePreviewFonts.FontPreview(); FlatThemePreviewFonts.FontPreview miniPreview = new FlatThemePreviewFonts.FontPreview(); + FlatThemePreviewFonts.FontPreview lightPreview = new FlatThemePreviewFonts.FontPreview(); + FlatThemePreviewFonts.FontPreview semiboldPreview = new FlatThemePreviewFonts.FontPreview(); FlatThemePreviewFonts.FontPreview monospacedPreview = new FlatThemePreviewFonts.FontPreview(); JLabel scaleLabel = new JLabel(); scaleValueLabel = new JLabel(); @@ -76,6 +78,8 @@ public class FlatThemePreviewFonts "[bottom]" + "[bottom]" + "[bottom]para" + + "[]" + + "[]para" + "[]para" + "[]")); @@ -143,19 +147,29 @@ public class FlatThemePreviewFonts miniPreview.setFontStyle("mini"); add(miniPreview, "cell 0 12,gapx 12"); + //---- lightPreview ---- + lightPreview.setFontType("Light"); + lightPreview.setFontStyle("light"); + add(lightPreview, "cell 0 13,gapx 12"); + + //---- semiboldPreview ---- + semiboldPreview.setFontType("Semibold"); + semiboldPreview.setFontStyle("semibold"); + add(semiboldPreview, "cell 0 14,gapx 12"); + //---- monospacedPreview ---- monospacedPreview.setFontType("Monospaced"); monospacedPreview.setFontStyle("monospaced"); - add(monospacedPreview, "cell 0 13,gapx 12"); + add(monospacedPreview, "cell 0 15,gapx 12"); //---- scaleLabel ---- scaleLabel.setText("Fonts are scaled by:"); - add(scaleLabel, "cell 0 14,gapx 12"); + add(scaleLabel, "cell 0 16,gapx 12"); //---- scaleValueLabel ---- scaleValueLabel.setText("1x"); scaleValueLabel.putClientProperty("FlatLaf.styleClass", "h2"); - add(scaleValueLabel, "cell 0 14"); + add(scaleValueLabel, "cell 0 16"); // JFormDesigner - End of component initialization //GEN-END:initComponents } diff --git a/flatlaf-theme-editor/src/main/java/com/formdev/flatlaf/themeeditor/FlatThemePreviewFonts.jfd b/flatlaf-theme-editor/src/main/java/com/formdev/flatlaf/themeeditor/FlatThemePreviewFonts.jfd index e7700964..002e1736 100644 --- a/flatlaf-theme-editor/src/main/java/com/formdev/flatlaf/themeeditor/FlatThemePreviewFonts.jfd +++ b/flatlaf-theme-editor/src/main/java/com/formdev/flatlaf/themeeditor/FlatThemePreviewFonts.jfd @@ -9,7 +9,7 @@ new FormModel { add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) { "$layoutConstraints": "ltr,insets dialog,hidemode 3" "$columnConstraints": "[left]unrel" - "$rowConstraints": "[][bottom][bottom][bottom][bottom][bottom][bottom]para[][bottom][bottom][bottom][bottom][bottom]para[]para[]" + "$rowConstraints": "[][bottom][bottom][bottom][bottom][bottom][bottom]para[][bottom][bottom][bottom][bottom][bottom]para[][]para[]para[]" } ) { name: "this" add( new FormComponent( "javax.swing.JLabel" ) { @@ -105,18 +105,32 @@ new FormModel { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { "value": "cell 0 12,gapx 12" } ) + add( new FormComponent( "com.formdev.flatlaf.themeeditor.FlatThemePreviewFonts$FontPreview" ) { + name: "lightPreview" + "fontType": "Light" + "fontStyle": "light" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 0 13,gapx 12" + } ) + add( new FormComponent( "com.formdev.flatlaf.themeeditor.FlatThemePreviewFonts$FontPreview" ) { + name: "semiboldPreview" + "fontType": "Semibold" + "fontStyle": "semibold" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 0 14,gapx 12" + } ) add( new FormComponent( "com.formdev.flatlaf.themeeditor.FlatThemePreviewFonts$FontPreview" ) { name: "monospacedPreview" "fontType": "Monospaced" "fontStyle": "monospaced" }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { - "value": "cell 0 13,gapx 12" + "value": "cell 0 15,gapx 12" } ) add( new FormComponent( "javax.swing.JLabel" ) { name: "scaleLabel" "text": "Fonts are scaled by:" }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { - "value": "cell 0 14,gapx 12" + "value": "cell 0 16,gapx 12" } ) add( new FormComponent( "javax.swing.JLabel" ) { name: "scaleValueLabel" @@ -126,11 +140,11 @@ new FormModel { "JavaCodeGenerator.variableLocal": false } }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { - "value": "cell 0 14" + "value": "cell 0 16" } ) }, new FormLayoutConstraints( null ) { "location": new java.awt.Point( 5, 0 ) - "size": new java.awt.Dimension( 335, 405 ) + "size": new java.awt.Dimension( 335, 495 ) } ) add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) { "$layoutConstraints": "insets 0,hidemode 3" @@ -162,7 +176,7 @@ new FormModel { "value": "cell 1 0" } ) }, new FormLayoutConstraints( null ) { - "location": new java.awt.Point( 5, 435 ) + "location": new java.awt.Point( 5, 545 ) "size": new java.awt.Dimension( 235, 65 ) } ) } diff --git a/flatlaf-theme-editor/src/main/resources/com/formdev/flatlaf/themeeditor/FlatLafUIKeys.txt b/flatlaf-theme-editor/src/main/resources/com/formdev/flatlaf/themeeditor/FlatLafUIKeys.txt index ea68ec20..caa55b35 100644 --- a/flatlaf-theme-editor/src/main/resources/com/formdev/flatlaf/themeeditor/FlatLafUIKeys.txt +++ b/flatlaf-theme-editor/src/main/resources/com/formdev/flatlaf/themeeditor/FlatLafUIKeys.txt @@ -1071,9 +1071,11 @@ ViewportUI [style].h3 [style].h4 [style].large +[style].light [style].medium [style].mini [style].monospaced +[style].semibold [style].small activeCaption activeCaptionBorder @@ -1102,12 +1104,14 @@ infoText laf.dark laf.scaleFactor large.font +light.font medium.font menu menuText mini.font monospaced.font scrollbar +semibold.font small.font swingx/TaskPaneUI text From f742f838341084dbc2c0d9eab3d826d0e2f4d099 Mon Sep 17 00:00:00 2001 From: Karl Tauber Date: Tue, 26 Oct 2021 13:16:52 +0200 Subject: [PATCH 14/22] Typography: added thin font/style --- .../com/formdev/flatlaf/FlatLaf.properties | 6 +++++ .../uidefaults/FlatDarkLaf_1.8.0_202-mac.txt | 6 +++++ .../uidefaults/FlatDarkLaf_1.8.0_202.txt | 10 +++++++++ .../uidefaults/FlatLightLaf_1.8.0_202-mac.txt | 6 +++++ .../uidefaults/FlatLightLaf_1.8.0_202.txt | 10 +++++++++ .../uidefaults/FlatTestLaf_1.8.0_202.txt | 22 +++++++++++++++++++ .../themeeditor/FlatThemePreviewFonts.java | 17 +++++++++----- .../themeeditor/FlatThemePreviewFonts.jfd | 19 +++++++++++----- .../flatlaf/themeeditor/FlatLafUIKeys.txt | 2 ++ 9 files changed, 87 insertions(+), 11 deletions(-) diff --git a/flatlaf-core/src/main/resources/com/formdev/flatlaf/FlatLaf.properties b/flatlaf-core/src/main/resources/com/formdev/flatlaf/FlatLaf.properties index 4dafd803..a0e80922 100644 --- a/flatlaf-core/src/main/resources/com/formdev/flatlaf/FlatLaf.properties +++ b/flatlaf-core/src/main/resources/com/formdev/flatlaf/FlatLaf.properties @@ -47,15 +47,20 @@ mini.font = -3 # font weights # Windows +# (use Segoe UI Light because there is no thin font available on Windows) +[win]thin.font = "Segoe UI Light" [win]light.font = "Segoe UI Light" [win]semibold.font = "Segoe UI Semibold" # macOS +[mac]thin.font = "HelveticaNeue-Thin" [mac]light.font = "HelveticaNeue-Light" [mac]semibold.font = "HelveticaNeue-Medium" # Linux +[linux]thin.font = "Lato Thin", "Ubuntu Thin", "Cantarell Thin" [linux]light.font = "Lato Light", "Ubuntu Light", "Cantarell Light" [linux]semibold.font = "Lato Semibold", "Ubuntu Medium" # fallback for unknown platform +thin.font = +0 light.font = +0 semibold.font = +0 @@ -76,6 +81,7 @@ monospaced.font = Monospaced [style].medium = font: $medium.font [style].small = font: $small.font [style].mini = font: $mini.font +[style].thin = font: $thin.font [style].light = font: $light.font [style].semibold = font: $semibold.font [style].monospaced = font: $monospaced.font diff --git a/flatlaf-testing/dumps/uidefaults/FlatDarkLaf_1.8.0_202-mac.txt b/flatlaf-testing/dumps/uidefaults/FlatDarkLaf_1.8.0_202-mac.txt index 18039343..e137defd 100644 --- a/flatlaf-testing/dumps/uidefaults/FlatDarkLaf_1.8.0_202-mac.txt +++ b/flatlaf-testing/dumps/uidefaults/FlatDarkLaf_1.8.0_202-mac.txt @@ -134,3 +134,9 @@ - small.font [active] Segoe UI plain 10 javax.swing.plaf.FontUIResource [UI] + small.font [active] Helvetica Neue plain 11 javax.swing.plaf.FontUIResource [UI] + + +#---- thin ---- + +- thin.font [active] Segoe UI Light plain 12 javax.swing.plaf.FontUIResource [UI] ++ thin.font [active] HelveticaNeue-Thin plain 13 javax.swing.plaf.FontUIResource [UI] diff --git a/flatlaf-testing/dumps/uidefaults/FlatDarkLaf_1.8.0_202.txt b/flatlaf-testing/dumps/uidefaults/FlatDarkLaf_1.8.0_202.txt index 4d706a84..5348a5a1 100644 --- a/flatlaf-testing/dumps/uidefaults/FlatDarkLaf_1.8.0_202.txt +++ b/flatlaf-testing/dumps/uidefaults/FlatDarkLaf_1.8.0_202.txt @@ -1396,6 +1396,7 @@ ViewportUI com.formdev.flatlaf.ui.FlatViewportUI [style].monospaced font: $monospaced.font [style].semibold font: $semibold.font [style].small font: $small.font +[style].thin font: $thin.font #---- ---- @@ -1522,6 +1523,15 @@ textHighlight #4b6eaf HSL 219 40 49 javax.swing.plaf.Colo textHighlightText #bbbbbb HSL 0 0 73 javax.swing.plaf.ColorUIResource [UI] textInactiveText #8c8c8c HSL 0 0 55 javax.swing.plaf.ColorUIResource [UI] textText #bbbbbb HSL 0 0 73 javax.swing.plaf.ColorUIResource [UI] + + +#---- thin ---- + +thin.font [active] Segoe UI Light plain 12 javax.swing.plaf.FontUIResource [UI] + + +#---- ---- + window #3c3f41 HSL 204 4 25 javax.swing.plaf.ColorUIResource [UI] windowBorder #bbbbbb HSL 0 0 73 javax.swing.plaf.ColorUIResource [UI] windowText #bbbbbb HSL 0 0 73 javax.swing.plaf.ColorUIResource [UI] diff --git a/flatlaf-testing/dumps/uidefaults/FlatLightLaf_1.8.0_202-mac.txt b/flatlaf-testing/dumps/uidefaults/FlatLightLaf_1.8.0_202-mac.txt index 18039343..e137defd 100644 --- a/flatlaf-testing/dumps/uidefaults/FlatLightLaf_1.8.0_202-mac.txt +++ b/flatlaf-testing/dumps/uidefaults/FlatLightLaf_1.8.0_202-mac.txt @@ -134,3 +134,9 @@ - small.font [active] Segoe UI plain 10 javax.swing.plaf.FontUIResource [UI] + small.font [active] Helvetica Neue plain 11 javax.swing.plaf.FontUIResource [UI] + + +#---- thin ---- + +- thin.font [active] Segoe UI Light plain 12 javax.swing.plaf.FontUIResource [UI] ++ thin.font [active] HelveticaNeue-Thin plain 13 javax.swing.plaf.FontUIResource [UI] diff --git a/flatlaf-testing/dumps/uidefaults/FlatLightLaf_1.8.0_202.txt b/flatlaf-testing/dumps/uidefaults/FlatLightLaf_1.8.0_202.txt index f6748391..22ed02dc 100644 --- a/flatlaf-testing/dumps/uidefaults/FlatLightLaf_1.8.0_202.txt +++ b/flatlaf-testing/dumps/uidefaults/FlatLightLaf_1.8.0_202.txt @@ -1401,6 +1401,7 @@ ViewportUI com.formdev.flatlaf.ui.FlatViewportUI [style].monospaced font: $monospaced.font [style].semibold font: $semibold.font [style].small font: $small.font +[style].thin font: $thin.font #---- ---- @@ -1527,6 +1528,15 @@ textHighlight #2675bf HSL 209 67 45 javax.swing.plaf.Colo textHighlightText #ffffff HSL 0 0 100 javax.swing.plaf.ColorUIResource [UI] textInactiveText #8c8c8c HSL 0 0 55 javax.swing.plaf.ColorUIResource [UI] textText #000000 HSL 0 0 0 javax.swing.plaf.ColorUIResource [UI] + + +#---- thin ---- + +thin.font [active] Segoe UI Light plain 12 javax.swing.plaf.FontUIResource [UI] + + +#---- ---- + window #f2f2f2 HSL 0 0 95 javax.swing.plaf.ColorUIResource [UI] windowBorder #000000 HSL 0 0 0 javax.swing.plaf.ColorUIResource [UI] windowText #000000 HSL 0 0 0 javax.swing.plaf.ColorUIResource [UI] diff --git a/flatlaf-testing/dumps/uidefaults/FlatTestLaf_1.8.0_202.txt b/flatlaf-testing/dumps/uidefaults/FlatTestLaf_1.8.0_202.txt index 7638a905..53467ad8 100644 --- a/flatlaf-testing/dumps/uidefaults/FlatTestLaf_1.8.0_202.txt +++ b/flatlaf-testing/dumps/uidefaults/FlatTestLaf_1.8.0_202.txt @@ -1399,10 +1399,13 @@ ViewportUI com.formdev.flatlaf.ui.FlatViewportUI [style].h3 font: $h3.font [style].h4 font: $h4.font [style].large font: $large.font +[style].light font: $light.font [style].medium font: $medium.font [style].mini font: $mini.font [style].monospaced font: $monospaced.font +[style].semibold font: $semibold.font [style].small font: $small.font +[style].thin font: $thin.font #---- ---- @@ -1476,6 +1479,11 @@ laf.scaleFactor [active] 1.0 large.font [active] Segoe UI plain 14 javax.swing.plaf.FontUIResource [UI] +#---- light ---- + +light.font [active] Segoe UI Light plain 12 javax.swing.plaf.FontUIResource [UI] + + #---- medium ---- medium.font [active] Segoe UI plain 11 javax.swing.plaf.FontUIResource [UI] @@ -1502,6 +1510,11 @@ monospaced.font [active] Consolas plain 12 javax.swing.plaf.Fo scrollbar #88ff88 HSL 120 100 77 javax.swing.plaf.ColorUIResource [UI] +#---- semibold ---- + +semibold.font [active] Segoe UI Semibold plain 12 javax.swing.plaf.FontUIResource [UI] + + #---- small ---- small.font [active] Segoe UI plain 10 javax.swing.plaf.FontUIResource [UI] @@ -1519,6 +1532,15 @@ textHighlight #00aa00 HSL 120 100 33 javax.swing.plaf.Colo textHighlightText #ffff00 HSL 60 100 50 javax.swing.plaf.ColorUIResource [UI] textInactiveText #000088 HSL 240 100 27 javax.swing.plaf.ColorUIResource [UI] textText #ff0000 HSL 0 100 50 javax.swing.plaf.ColorUIResource [UI] + + +#---- thin ---- + +thin.font [active] Segoe UI Light plain 12 javax.swing.plaf.FontUIResource [UI] + + +#---- ---- + window #ccffcc HSL 120 100 90 javax.swing.plaf.ColorUIResource [UI] windowBorder #ff0000 HSL 0 100 50 javax.swing.plaf.ColorUIResource [UI] windowText #ff0000 HSL 0 100 50 javax.swing.plaf.ColorUIResource [UI] 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 9a8d2510..28a64367 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 @@ -53,6 +53,7 @@ public class FlatThemePreviewFonts FlatThemePreviewFonts.FontPreview mediumPreview = new FlatThemePreviewFonts.FontPreview(); FlatThemePreviewFonts.FontPreview smallPreview = new FlatThemePreviewFonts.FontPreview(); FlatThemePreviewFonts.FontPreview miniPreview = new FlatThemePreviewFonts.FontPreview(); + FlatThemePreviewFonts.FontPreview thinPreview = new FlatThemePreviewFonts.FontPreview(); FlatThemePreviewFonts.FontPreview lightPreview = new FlatThemePreviewFonts.FontPreview(); FlatThemePreviewFonts.FontPreview semiboldPreview = new FlatThemePreviewFonts.FontPreview(); FlatThemePreviewFonts.FontPreview monospacedPreview = new FlatThemePreviewFonts.FontPreview(); @@ -79,6 +80,7 @@ public class FlatThemePreviewFonts "[bottom]" + "[bottom]para" + "[]" + + "[]" + "[]para" + "[]para" + "[]")); @@ -147,29 +149,34 @@ public class FlatThemePreviewFonts miniPreview.setFontStyle("mini"); add(miniPreview, "cell 0 12,gapx 12"); + //---- thinPreview ---- + thinPreview.setFontType("Thin"); + thinPreview.setFontStyle("thin"); + add(thinPreview, "cell 0 13,gapx 12"); + //---- lightPreview ---- lightPreview.setFontType("Light"); lightPreview.setFontStyle("light"); - add(lightPreview, "cell 0 13,gapx 12"); + add(lightPreview, "cell 0 14,gapx 12"); //---- semiboldPreview ---- semiboldPreview.setFontType("Semibold"); semiboldPreview.setFontStyle("semibold"); - add(semiboldPreview, "cell 0 14,gapx 12"); + add(semiboldPreview, "cell 0 15,gapx 12"); //---- monospacedPreview ---- monospacedPreview.setFontType("Monospaced"); monospacedPreview.setFontStyle("monospaced"); - add(monospacedPreview, "cell 0 15,gapx 12"); + add(monospacedPreview, "cell 0 16,gapx 12"); //---- scaleLabel ---- scaleLabel.setText("Fonts are scaled by:"); - add(scaleLabel, "cell 0 16,gapx 12"); + add(scaleLabel, "cell 0 17,gapx 12"); //---- scaleValueLabel ---- scaleValueLabel.setText("1x"); scaleValueLabel.putClientProperty("FlatLaf.styleClass", "h2"); - add(scaleValueLabel, "cell 0 16"); + add(scaleValueLabel, "cell 0 17"); // JFormDesigner - End of component initialization //GEN-END:initComponents } diff --git a/flatlaf-theme-editor/src/main/java/com/formdev/flatlaf/themeeditor/FlatThemePreviewFonts.jfd b/flatlaf-theme-editor/src/main/java/com/formdev/flatlaf/themeeditor/FlatThemePreviewFonts.jfd index 002e1736..eeda2887 100644 --- a/flatlaf-theme-editor/src/main/java/com/formdev/flatlaf/themeeditor/FlatThemePreviewFonts.jfd +++ b/flatlaf-theme-editor/src/main/java/com/formdev/flatlaf/themeeditor/FlatThemePreviewFonts.jfd @@ -9,7 +9,7 @@ new FormModel { add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) { "$layoutConstraints": "ltr,insets dialog,hidemode 3" "$columnConstraints": "[left]unrel" - "$rowConstraints": "[][bottom][bottom][bottom][bottom][bottom][bottom]para[][bottom][bottom][bottom][bottom][bottom]para[][]para[]para[]" + "$rowConstraints": "[][bottom][bottom][bottom][bottom][bottom][bottom]para[][bottom][bottom][bottom][bottom][bottom]para[][][]para[]para[]" } ) { name: "this" add( new FormComponent( "javax.swing.JLabel" ) { @@ -105,32 +105,39 @@ new FormModel { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { "value": "cell 0 12,gapx 12" } ) + add( new FormComponent( "com.formdev.flatlaf.themeeditor.FlatThemePreviewFonts$FontPreview" ) { + name: "thinPreview" + "fontType": "Thin" + "fontStyle": "thin" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 0 13,gapx 12" + } ) add( new FormComponent( "com.formdev.flatlaf.themeeditor.FlatThemePreviewFonts$FontPreview" ) { name: "lightPreview" "fontType": "Light" "fontStyle": "light" }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { - "value": "cell 0 13,gapx 12" + "value": "cell 0 14,gapx 12" } ) add( new FormComponent( "com.formdev.flatlaf.themeeditor.FlatThemePreviewFonts$FontPreview" ) { name: "semiboldPreview" "fontType": "Semibold" "fontStyle": "semibold" }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { - "value": "cell 0 14,gapx 12" + "value": "cell 0 15,gapx 12" } ) add( new FormComponent( "com.formdev.flatlaf.themeeditor.FlatThemePreviewFonts$FontPreview" ) { name: "monospacedPreview" "fontType": "Monospaced" "fontStyle": "monospaced" }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { - "value": "cell 0 15,gapx 12" + "value": "cell 0 16,gapx 12" } ) add( new FormComponent( "javax.swing.JLabel" ) { name: "scaleLabel" "text": "Fonts are scaled by:" }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { - "value": "cell 0 16,gapx 12" + "value": "cell 0 17,gapx 12" } ) add( new FormComponent( "javax.swing.JLabel" ) { name: "scaleValueLabel" @@ -140,7 +147,7 @@ new FormModel { "JavaCodeGenerator.variableLocal": false } }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { - "value": "cell 0 16" + "value": "cell 0 17" } ) }, new FormLayoutConstraints( null ) { "location": new java.awt.Point( 5, 0 ) diff --git a/flatlaf-theme-editor/src/main/resources/com/formdev/flatlaf/themeeditor/FlatLafUIKeys.txt b/flatlaf-theme-editor/src/main/resources/com/formdev/flatlaf/themeeditor/FlatLafUIKeys.txt index caa55b35..36850580 100644 --- a/flatlaf-theme-editor/src/main/resources/com/formdev/flatlaf/themeeditor/FlatLafUIKeys.txt +++ b/flatlaf-theme-editor/src/main/resources/com/formdev/flatlaf/themeeditor/FlatLafUIKeys.txt @@ -1077,6 +1077,7 @@ ViewportUI [style].monospaced [style].semibold [style].small +[style].thin activeCaption activeCaptionBorder activeCaptionText @@ -1119,6 +1120,7 @@ textHighlight textHighlightText textInactiveText textText +thin.font window windowBorder windowText From 78e37f7ab45d70f667ce3444406b4e317c879049 Mon Sep 17 00:00:00 2001 From: Karl Tauber Date: Thu, 4 Nov 2021 12:09:58 +0100 Subject: [PATCH 15/22] Typography: since there is no thin font available on Windows, use "Segoe UI Light" (which looks thin IMHO) for `thin.font` and "Segoe UI Semilight" for `light.font` --- .../src/main/resources/com/formdev/flatlaf/FlatLaf.properties | 2 +- flatlaf-testing/dumps/uidefaults/FlatDarkLaf_1.8.0_202-mac.txt | 2 +- flatlaf-testing/dumps/uidefaults/FlatDarkLaf_1.8.0_202.txt | 2 +- flatlaf-testing/dumps/uidefaults/FlatLightLaf_1.8.0_202-mac.txt | 2 +- flatlaf-testing/dumps/uidefaults/FlatLightLaf_1.8.0_202.txt | 2 +- flatlaf-testing/dumps/uidefaults/FlatTestLaf_1.8.0_202.txt | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/flatlaf-core/src/main/resources/com/formdev/flatlaf/FlatLaf.properties b/flatlaf-core/src/main/resources/com/formdev/flatlaf/FlatLaf.properties index a0e80922..88a3e21e 100644 --- a/flatlaf-core/src/main/resources/com/formdev/flatlaf/FlatLaf.properties +++ b/flatlaf-core/src/main/resources/com/formdev/flatlaf/FlatLaf.properties @@ -49,7 +49,7 @@ mini.font = -3 # Windows # (use Segoe UI Light because there is no thin font available on Windows) [win]thin.font = "Segoe UI Light" -[win]light.font = "Segoe UI Light" +[win]light.font = "Segoe UI Semilight" [win]semibold.font = "Segoe UI Semibold" # macOS [mac]thin.font = "HelveticaNeue-Thin" diff --git a/flatlaf-testing/dumps/uidefaults/FlatDarkLaf_1.8.0_202-mac.txt b/flatlaf-testing/dumps/uidefaults/FlatDarkLaf_1.8.0_202-mac.txt index e137defd..68bd5be1 100644 --- a/flatlaf-testing/dumps/uidefaults/FlatDarkLaf_1.8.0_202-mac.txt +++ b/flatlaf-testing/dumps/uidefaults/FlatDarkLaf_1.8.0_202-mac.txt @@ -102,7 +102,7 @@ #---- light ---- -- light.font [active] Segoe UI Light plain 12 javax.swing.plaf.FontUIResource [UI] +- light.font [active] Segoe UI Semilight plain 12 javax.swing.plaf.FontUIResource [UI] + light.font [active] HelveticaNeue-Light plain 13 javax.swing.plaf.FontUIResource [UI] diff --git a/flatlaf-testing/dumps/uidefaults/FlatDarkLaf_1.8.0_202.txt b/flatlaf-testing/dumps/uidefaults/FlatDarkLaf_1.8.0_202.txt index 5348a5a1..e4edeea2 100644 --- a/flatlaf-testing/dumps/uidefaults/FlatDarkLaf_1.8.0_202.txt +++ b/flatlaf-testing/dumps/uidefaults/FlatDarkLaf_1.8.0_202.txt @@ -1472,7 +1472,7 @@ large.font [active] Segoe UI plain 14 javax.swing.plaf.Fo #---- light ---- -light.font [active] Segoe UI Light plain 12 javax.swing.plaf.FontUIResource [UI] +light.font [active] Segoe UI Semilight plain 12 javax.swing.plaf.FontUIResource [UI] #---- medium ---- diff --git a/flatlaf-testing/dumps/uidefaults/FlatLightLaf_1.8.0_202-mac.txt b/flatlaf-testing/dumps/uidefaults/FlatLightLaf_1.8.0_202-mac.txt index e137defd..68bd5be1 100644 --- a/flatlaf-testing/dumps/uidefaults/FlatLightLaf_1.8.0_202-mac.txt +++ b/flatlaf-testing/dumps/uidefaults/FlatLightLaf_1.8.0_202-mac.txt @@ -102,7 +102,7 @@ #---- light ---- -- light.font [active] Segoe UI Light plain 12 javax.swing.plaf.FontUIResource [UI] +- light.font [active] Segoe UI Semilight plain 12 javax.swing.plaf.FontUIResource [UI] + light.font [active] HelveticaNeue-Light plain 13 javax.swing.plaf.FontUIResource [UI] diff --git a/flatlaf-testing/dumps/uidefaults/FlatLightLaf_1.8.0_202.txt b/flatlaf-testing/dumps/uidefaults/FlatLightLaf_1.8.0_202.txt index 22ed02dc..f1b76b09 100644 --- a/flatlaf-testing/dumps/uidefaults/FlatLightLaf_1.8.0_202.txt +++ b/flatlaf-testing/dumps/uidefaults/FlatLightLaf_1.8.0_202.txt @@ -1477,7 +1477,7 @@ large.font [active] Segoe UI plain 14 javax.swing.plaf.Fo #---- light ---- -light.font [active] Segoe UI Light plain 12 javax.swing.plaf.FontUIResource [UI] +light.font [active] Segoe UI Semilight plain 12 javax.swing.plaf.FontUIResource [UI] #---- medium ---- diff --git a/flatlaf-testing/dumps/uidefaults/FlatTestLaf_1.8.0_202.txt b/flatlaf-testing/dumps/uidefaults/FlatTestLaf_1.8.0_202.txt index 53467ad8..efdc7525 100644 --- a/flatlaf-testing/dumps/uidefaults/FlatTestLaf_1.8.0_202.txt +++ b/flatlaf-testing/dumps/uidefaults/FlatTestLaf_1.8.0_202.txt @@ -1481,7 +1481,7 @@ large.font [active] Segoe UI plain 14 javax.swing.plaf.Fo #---- light ---- -light.font [active] Segoe UI Light plain 12 javax.swing.plaf.FontUIResource [UI] +light.font [active] Segoe UI Semilight plain 12 javax.swing.plaf.FontUIResource [UI] #---- medium ---- From 1be84de26b34ab6c2c042c1e6062001be9b5d61d Mon Sep 17 00:00:00 2001 From: Karl Tauber Date: Thu, 4 Nov 2021 12:48:46 +0100 Subject: [PATCH 16/22] Typography: added thin/light/semibold fonts to demo --- .../flatlaf/demo/BasicComponentsPanel.java | 38 +++++++++++++--- .../flatlaf/demo/BasicComponentsPanel.jfd | 43 ++++++++++++++++--- 2 files changed, 68 insertions(+), 13 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 1acbc5d7..ac1ecfcc 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 @@ -137,6 +137,10 @@ class BasicComponentsPanel JLabel h2Label = new JLabel(); JLabel h3Label = new JLabel(); JLabel h4Label = new JLabel(); + JLabel thinLabel = new JLabel(); + JLabel lightLabel = new JLabel(); + JLabel semiboldLabel = new JLabel(); + JLabel label3 = new JLabel(); JLabel largeLabel = new JLabel(); JLabel defaultLabel = new JLabel(); JLabel mediumLabel = new JLabel(); @@ -174,6 +178,7 @@ class BasicComponentsPanel "[]" + "[]" + "[]" + + "[]0" + "[]")); //---- labelLabel ---- @@ -715,34 +720,55 @@ class BasicComponentsPanel h4Label.putClientProperty("FlatLaf.styleClass", "h4"); add(h4Label, "cell 1 15 5 1"); + //---- thinLabel ---- + thinLabel.setText("thin"); + thinLabel.putClientProperty("FlatLaf.style", "font: 200% $thin.font"); + add(thinLabel, "cell 1 15 5 1,gapx 30"); + + //---- lightLabel ---- + lightLabel.setText("light"); + lightLabel.putClientProperty("FlatLaf.style", "font: 200% $light.font"); + add(lightLabel, "cell 1 15 5 1"); + + //---- semiboldLabel ---- + semiboldLabel.setText("semibold"); + semiboldLabel.putClientProperty("FlatLaf.style", "font: 200% $semibold.font"); + add(semiboldLabel, "cell 1 15 5 1"); + + //---- label3 ---- + label3.setText("(200%)"); + label3.putClientProperty("FlatLaf.styleClass", "small"); + label3.setEnabled(false); + add(label3, "cell 1 15 5 1"); + //---- largeLabel ---- largeLabel.setText("large"); largeLabel.putClientProperty("FlatLaf.styleClass", "large"); - add(largeLabel, "cell 1 15 5 1,gapx 30"); + add(largeLabel, "cell 1 16 5 1"); //---- defaultLabel ---- defaultLabel.setText("default/regular"); - add(defaultLabel, "cell 1 15 5 1"); + add(defaultLabel, "cell 1 16 5 1"); //---- mediumLabel ---- mediumLabel.setText("medium"); mediumLabel.putClientProperty("FlatLaf.styleClass", "medium"); - add(mediumLabel, "cell 1 15 5 1"); + add(mediumLabel, "cell 1 16 5 1"); //---- smallLabel ---- smallLabel.setText("small"); smallLabel.putClientProperty("FlatLaf.styleClass", "small"); - add(smallLabel, "cell 1 15 5 1"); + add(smallLabel, "cell 1 16 5 1"); //---- miniLabel ---- miniLabel.setText("mini"); miniLabel.putClientProperty("FlatLaf.styleClass", "mini"); - add(miniLabel, "cell 1 15 5 1"); + add(miniLabel, "cell 1 16 5 1"); //---- monospacedLabel ---- monospacedLabel.setText("monospaced"); monospacedLabel.putClientProperty("FlatLaf.styleClass", "monospaced"); - add(monospacedLabel, "cell 1 15 5 1,gapx 30"); + add(monospacedLabel, "cell 1 16 5 1,gapx 30"); //======== popupMenu1 ======== { diff --git a/flatlaf-demo/src/main/java/com/formdev/flatlaf/demo/BasicComponentsPanel.jfd b/flatlaf-demo/src/main/java/com/formdev/flatlaf/demo/BasicComponentsPanel.jfd index 6c573a57..3c2069a6 100644 --- a/flatlaf-demo/src/main/java/com/formdev/flatlaf/demo/BasicComponentsPanel.jfd +++ b/flatlaf-demo/src/main/java/com/formdev/flatlaf/demo/BasicComponentsPanel.jfd @@ -9,7 +9,7 @@ new FormModel { add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) { "$layoutConstraints": "insets dialog,hidemode 3" "$columnConstraints": "[][sizegroup 1][sizegroup 1][sizegroup 1][][]" - "$rowConstraints": "[][][][][][][][][][][][]para[][][][]" + "$rowConstraints": "[][][][][][][][][][][][]para[][][][]0[]" } ) { name: "this" add( new FormComponent( "javax.swing.JLabel" ) { @@ -719,46 +719,75 @@ new FormModel { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { "value": "cell 1 15 5 1" } ) + add( new FormComponent( "javax.swing.JLabel" ) { + name: "thinLabel" + "text": "thin" + "$client.FlatLaf.style": "font: 200% $thin.font" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 1 15 5 1,gapx 30" + } ) + add( new FormComponent( "javax.swing.JLabel" ) { + name: "lightLabel" + "text": "light" + "$client.FlatLaf.style": "font: 200% $light.font" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 1 15 5 1" + } ) + add( new FormComponent( "javax.swing.JLabel" ) { + name: "semiboldLabel" + "text": "semibold" + "$client.FlatLaf.style": "font: 200% $semibold.font" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 1 15 5 1" + } ) + add( new FormComponent( "javax.swing.JLabel" ) { + name: "label3" + "text": "(200%)" + "$client.FlatLaf.styleClass": "small" + "enabled": false + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 1 15 5 1" + } ) add( new FormComponent( "javax.swing.JLabel" ) { name: "largeLabel" "text": "large" "$client.FlatLaf.styleClass": "large" }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { - "value": "cell 1 15 5 1,gapx 30" + "value": "cell 1 16 5 1" } ) add( new FormComponent( "javax.swing.JLabel" ) { name: "defaultLabel" "text": "default/regular" }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { - "value": "cell 1 15 5 1" + "value": "cell 1 16 5 1" } ) add( new FormComponent( "javax.swing.JLabel" ) { name: "mediumLabel" "text": "medium" "$client.FlatLaf.styleClass": "medium" }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { - "value": "cell 1 15 5 1" + "value": "cell 1 16 5 1" } ) add( new FormComponent( "javax.swing.JLabel" ) { name: "smallLabel" "text": "small" "$client.FlatLaf.styleClass": "small" }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { - "value": "cell 1 15 5 1" + "value": "cell 1 16 5 1" } ) add( new FormComponent( "javax.swing.JLabel" ) { name: "miniLabel" "text": "mini" "$client.FlatLaf.styleClass": "mini" }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { - "value": "cell 1 15 5 1" + "value": "cell 1 16 5 1" } ) add( new FormComponent( "javax.swing.JLabel" ) { name: "monospacedLabel" "text": "monospaced" "$client.FlatLaf.styleClass": "monospaced" }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { - "value": "cell 1 15 5 1,gapx 30" + "value": "cell 1 16 5 1,gapx 30" } ) }, new FormLayoutConstraints( null ) { "location": new java.awt.Point( 0, 0 ) From 7a2808243c4c1eac3db5e10db093eea47339da70 Mon Sep 17 00:00:00 2001 From: Karl Tauber Date: Thu, 4 Nov 2021 14:54:01 +0100 Subject: [PATCH 17/22] Typography: Demo: make typography/fonts visible in "screen shot" mode; hide password fields and labels --- .../flatlaf/demo/BasicComponentsPanel.java | 60 +++++++++++++------ .../flatlaf/demo/BasicComponentsPanel.jfd | 2 +- 2 files changed, 42 insertions(+), 20 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 ac1ecfcc..869688a2 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 @@ -22,6 +22,10 @@ import javax.swing.text.DefaultEditorKit; import com.formdev.flatlaf.FlatClientProperties; import com.formdev.flatlaf.extras.FlatSVGIcon; import com.formdev.flatlaf.icons.FlatSearchIcon; +import net.miginfocom.layout.AC; +import net.miginfocom.layout.BoundSize; +import net.miginfocom.layout.ConstraintParser; +import net.miginfocom.layout.DimConstraint; import net.miginfocom.swing.*; /** @@ -140,7 +144,7 @@ class BasicComponentsPanel JLabel thinLabel = new JLabel(); JLabel lightLabel = new JLabel(); JLabel semiboldLabel = new JLabel(); - JLabel label3 = new JLabel(); + JLabel fontZoomLabel = new JLabel(); JLabel largeLabel = new JLabel(); JLabel defaultLabel = new JLabel(); JLabel mediumLabel = new JLabel(); @@ -735,11 +739,11 @@ class BasicComponentsPanel semiboldLabel.putClientProperty("FlatLaf.style", "font: 200% $semibold.font"); add(semiboldLabel, "cell 1 15 5 1"); - //---- label3 ---- - label3.setText("(200%)"); - label3.putClientProperty("FlatLaf.styleClass", "small"); - label3.setEnabled(false); - add(label3, "cell 1 15 5 1"); + //---- fontZoomLabel ---- + fontZoomLabel.setText("(200%)"); + fontZoomLabel.putClientProperty("FlatLaf.styleClass", "small"); + fontZoomLabel.setEnabled(false); + add(fontZoomLabel, "cell 1 15 5 1"); //---- largeLabel ---- largeLabel.setText("large"); @@ -808,37 +812,55 @@ class BasicComponentsPanel if( FlatLafDemo.screenshotsMode ) { // hide some components Component[] hiddenComponents = { + labelLabel, label1, label2, button13, button14, button15, button16, comboBox5, comboBox6, - textField6, passwordField5, + textFieldLabel, textField2, textField4, textField6, formattedTextFieldLabel, formattedTextField1, formattedTextField2, formattedTextField3, formattedTextField4, formattedTextField5, + passwordFieldLabel, passwordField1, passwordField2, passwordField3, passwordField4, passwordField5, textAreaLabel, scrollPane1, scrollPane2, scrollPane3, scrollPane4, textArea5, editorPaneLabel, scrollPane5, scrollPane6, scrollPane7, scrollPane8, editorPane5, textPaneLabel, scrollPane9, scrollPane10, scrollPane11, scrollPane12, textPane5, errorHintsLabel, errorHintsTextField, errorHintsComboBox, errorHintsSpinner, warningHintsLabel, warningHintsTextField, warningHintsComboBox, warningHintsSpinner, + + fontZoomLabel, }; for( Component c : hiddenComponents ) c.setVisible( false ); - // move leading/trailing icon fields and password fields some rows up - Component[] formattedTextFields = { formattedTextFieldLabel, formattedTextField1, formattedTextField2, formattedTextField3, formattedTextField4 }; - Component[] passwordFields = { passwordFieldLabel, passwordField1, passwordField2, passwordField3, passwordField4 }; - Component[] iconsFields = { iconsLabel, leadingIconTextField, trailingIconTextField, iconsTextField }; + // update layout (change row gaps to zero) MigLayout layout = (MigLayout) getLayout(); - for( int i = 0; i < iconsFields.length; i++ ) { - Object cons = layout.getComponentConstraints( passwordFields[i] ); - layout.setComponentConstraints( iconsFields[i], cons ); - } - for( int i = 0; i < passwordFields.length; i++ ) { - Object cons = layout.getComponentConstraints( formattedTextFields[i] ); - layout.setComponentConstraints( passwordFields[i], cons ); - } + Object rowCons = layout.getRowConstraints(); + AC ac = (rowCons instanceof String) + ? ConstraintParser.parseColumnConstraints( (String) rowCons ) + : (AC) rowCons; + BoundSize zeroGap = ConstraintParser.parseBoundSize( "0", true, true ); + DimConstraint[] rows = ac.getConstaints(); + rows[6].setGapBefore( zeroGap ); + rows[7].setGapBefore( zeroGap ); + rows[8].setGapBefore( zeroGap ); + rows[9].setGapBefore( zeroGap ); + rows[10].setGapBefore( zeroGap ); + rows[11].setGapBefore( zeroGap ); + rows[11].setGapAfter( zeroGap ); + rows[12].setGapBefore( zeroGap ); + rows[13].setGapBefore( zeroGap ); + rows[15].setGapBefore( zeroGap ); + layout.setRowConstraints( ac ); + + // move two text field into same row as spinners + spinnerLabel.setText( "JSpinner / JTextField:" ); + layout.setComponentConstraints( textField1, "cell 3 5,growx" ); + layout.setComponentConstraints( textField3, "cell 4 5,growx" ); // make "Not editable disabled" combobox smaller Object cons = layout.getComponentConstraints( comboBox4 ); layout.setComponentConstraints( comboBox4, cons + ",width 50:50" ); + + revalidate(); + repaint(); } } diff --git a/flatlaf-demo/src/main/java/com/formdev/flatlaf/demo/BasicComponentsPanel.jfd b/flatlaf-demo/src/main/java/com/formdev/flatlaf/demo/BasicComponentsPanel.jfd index 3c2069a6..72833902 100644 --- a/flatlaf-demo/src/main/java/com/formdev/flatlaf/demo/BasicComponentsPanel.jfd +++ b/flatlaf-demo/src/main/java/com/formdev/flatlaf/demo/BasicComponentsPanel.jfd @@ -741,7 +741,7 @@ new FormModel { "value": "cell 1 15 5 1" } ) add( new FormComponent( "javax.swing.JLabel" ) { - name: "label3" + name: "fontZoomLabel" "text": "(200%)" "$client.FlatLaf.styleClass": "small" "enabled": false From 68897f04a23bfe7ba194e12057b358bfed528c69 Mon Sep 17 00:00:00 2001 From: Karl Tauber Date: Wed, 17 Nov 2021 00:23:54 +0100 Subject: [PATCH 18/22] Typography: removed thin font/style because - there is no thin font available on Windows - previously used "Segoe UI Light" for `thin.font` and "Segoe UI Semilight" for `light.font`, but "Segoe UI Semilight" is too close to regular font so that it is better to use "Segoe UI Light" for `light.font` and drop `thin.font` - the usefulness of having thin font in addition to light font is low on macOS use "HelveticaNeue-Thin" for `light.font` (instead of "HelveticaNeue-Light") --- .../com/formdev/flatlaf/FlatLaf.properties | 10 ++-------- .../flatlaf/demo/BasicComponentsPanel.java | 8 +------- .../flatlaf/demo/BasicComponentsPanel.jfd | 9 +-------- .../uidefaults/FlatDarkLaf_1.8.0_202-mac.txt | 10 ++-------- .../uidefaults/FlatDarkLaf_1.8.0_202.txt | 12 +----------- .../uidefaults/FlatLightLaf_1.8.0_202-mac.txt | 10 ++-------- .../uidefaults/FlatLightLaf_1.8.0_202.txt | 12 +----------- .../uidefaults/FlatTestLaf_1.8.0_202.txt | 12 +----------- .../themeeditor/FlatThemePreviewFonts.java | 17 +++++------------ .../themeeditor/FlatThemePreviewFonts.jfd | 19 ++++++------------- .../flatlaf/themeeditor/FlatLafUIKeys.txt | 2 -- 11 files changed, 22 insertions(+), 99 deletions(-) diff --git a/flatlaf-core/src/main/resources/com/formdev/flatlaf/FlatLaf.properties b/flatlaf-core/src/main/resources/com/formdev/flatlaf/FlatLaf.properties index 88a3e21e..630ef17e 100644 --- a/flatlaf-core/src/main/resources/com/formdev/flatlaf/FlatLaf.properties +++ b/flatlaf-core/src/main/resources/com/formdev/flatlaf/FlatLaf.properties @@ -47,20 +47,15 @@ mini.font = -3 # font weights # Windows -# (use Segoe UI Light because there is no thin font available on Windows) -[win]thin.font = "Segoe UI Light" -[win]light.font = "Segoe UI Semilight" +[win]light.font = "Segoe UI Light" [win]semibold.font = "Segoe UI Semibold" # macOS -[mac]thin.font = "HelveticaNeue-Thin" -[mac]light.font = "HelveticaNeue-Light" +[mac]light.font = "HelveticaNeue-Thin" [mac]semibold.font = "HelveticaNeue-Medium" # Linux -[linux]thin.font = "Lato Thin", "Ubuntu Thin", "Cantarell Thin" [linux]light.font = "Lato Light", "Ubuntu Light", "Cantarell Light" [linux]semibold.font = "Lato Semibold", "Ubuntu Medium" # fallback for unknown platform -thin.font = +0 light.font = +0 semibold.font = +0 @@ -81,7 +76,6 @@ monospaced.font = Monospaced [style].medium = font: $medium.font [style].small = font: $small.font [style].mini = font: $mini.font -[style].thin = font: $thin.font [style].light = font: $light.font [style].semibold = font: $semibold.font [style].monospaced = font: $monospaced.font 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 869688a2..89b6fd3c 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 @@ -141,7 +141,6 @@ class BasicComponentsPanel JLabel h2Label = new JLabel(); JLabel h3Label = new JLabel(); JLabel h4Label = new JLabel(); - JLabel thinLabel = new JLabel(); JLabel lightLabel = new JLabel(); JLabel semiboldLabel = new JLabel(); JLabel fontZoomLabel = new JLabel(); @@ -724,15 +723,10 @@ class BasicComponentsPanel h4Label.putClientProperty("FlatLaf.styleClass", "h4"); add(h4Label, "cell 1 15 5 1"); - //---- thinLabel ---- - thinLabel.setText("thin"); - thinLabel.putClientProperty("FlatLaf.style", "font: 200% $thin.font"); - add(thinLabel, "cell 1 15 5 1,gapx 30"); - //---- lightLabel ---- lightLabel.setText("light"); lightLabel.putClientProperty("FlatLaf.style", "font: 200% $light.font"); - add(lightLabel, "cell 1 15 5 1"); + add(lightLabel, "cell 1 15 5 1,gapx 30"); //---- semiboldLabel ---- semiboldLabel.setText("semibold"); diff --git a/flatlaf-demo/src/main/java/com/formdev/flatlaf/demo/BasicComponentsPanel.jfd b/flatlaf-demo/src/main/java/com/formdev/flatlaf/demo/BasicComponentsPanel.jfd index 72833902..f6f76f98 100644 --- a/flatlaf-demo/src/main/java/com/formdev/flatlaf/demo/BasicComponentsPanel.jfd +++ b/flatlaf-demo/src/main/java/com/formdev/flatlaf/demo/BasicComponentsPanel.jfd @@ -719,19 +719,12 @@ new FormModel { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { "value": "cell 1 15 5 1" } ) - add( new FormComponent( "javax.swing.JLabel" ) { - name: "thinLabel" - "text": "thin" - "$client.FlatLaf.style": "font: 200% $thin.font" - }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { - "value": "cell 1 15 5 1,gapx 30" - } ) add( new FormComponent( "javax.swing.JLabel" ) { name: "lightLabel" "text": "light" "$client.FlatLaf.style": "font: 200% $light.font" }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { - "value": "cell 1 15 5 1" + "value": "cell 1 15 5 1,gapx 30" } ) add( new FormComponent( "javax.swing.JLabel" ) { name: "semiboldLabel" diff --git a/flatlaf-testing/dumps/uidefaults/FlatDarkLaf_1.8.0_202-mac.txt b/flatlaf-testing/dumps/uidefaults/FlatDarkLaf_1.8.0_202-mac.txt index 68bd5be1..196104bf 100644 --- a/flatlaf-testing/dumps/uidefaults/FlatDarkLaf_1.8.0_202-mac.txt +++ b/flatlaf-testing/dumps/uidefaults/FlatDarkLaf_1.8.0_202-mac.txt @@ -102,8 +102,8 @@ #---- light ---- -- light.font [active] Segoe UI Semilight plain 12 javax.swing.plaf.FontUIResource [UI] -+ light.font [active] HelveticaNeue-Light plain 13 javax.swing.plaf.FontUIResource [UI] +- light.font [active] Segoe UI Light plain 12 javax.swing.plaf.FontUIResource [UI] ++ light.font [active] HelveticaNeue-Thin plain 13 javax.swing.plaf.FontUIResource [UI] #---- medium ---- @@ -134,9 +134,3 @@ - small.font [active] Segoe UI plain 10 javax.swing.plaf.FontUIResource [UI] + small.font [active] Helvetica Neue plain 11 javax.swing.plaf.FontUIResource [UI] - - -#---- thin ---- - -- thin.font [active] Segoe UI Light plain 12 javax.swing.plaf.FontUIResource [UI] -+ thin.font [active] HelveticaNeue-Thin plain 13 javax.swing.plaf.FontUIResource [UI] diff --git a/flatlaf-testing/dumps/uidefaults/FlatDarkLaf_1.8.0_202.txt b/flatlaf-testing/dumps/uidefaults/FlatDarkLaf_1.8.0_202.txt index e4edeea2..4d706a84 100644 --- a/flatlaf-testing/dumps/uidefaults/FlatDarkLaf_1.8.0_202.txt +++ b/flatlaf-testing/dumps/uidefaults/FlatDarkLaf_1.8.0_202.txt @@ -1396,7 +1396,6 @@ ViewportUI com.formdev.flatlaf.ui.FlatViewportUI [style].monospaced font: $monospaced.font [style].semibold font: $semibold.font [style].small font: $small.font -[style].thin font: $thin.font #---- ---- @@ -1472,7 +1471,7 @@ large.font [active] Segoe UI plain 14 javax.swing.plaf.Fo #---- light ---- -light.font [active] Segoe UI Semilight plain 12 javax.swing.plaf.FontUIResource [UI] +light.font [active] Segoe UI Light plain 12 javax.swing.plaf.FontUIResource [UI] #---- medium ---- @@ -1523,15 +1522,6 @@ textHighlight #4b6eaf HSL 219 40 49 javax.swing.plaf.Colo textHighlightText #bbbbbb HSL 0 0 73 javax.swing.plaf.ColorUIResource [UI] textInactiveText #8c8c8c HSL 0 0 55 javax.swing.plaf.ColorUIResource [UI] textText #bbbbbb HSL 0 0 73 javax.swing.plaf.ColorUIResource [UI] - - -#---- thin ---- - -thin.font [active] Segoe UI Light plain 12 javax.swing.plaf.FontUIResource [UI] - - -#---- ---- - window #3c3f41 HSL 204 4 25 javax.swing.plaf.ColorUIResource [UI] windowBorder #bbbbbb HSL 0 0 73 javax.swing.plaf.ColorUIResource [UI] windowText #bbbbbb HSL 0 0 73 javax.swing.plaf.ColorUIResource [UI] diff --git a/flatlaf-testing/dumps/uidefaults/FlatLightLaf_1.8.0_202-mac.txt b/flatlaf-testing/dumps/uidefaults/FlatLightLaf_1.8.0_202-mac.txt index 68bd5be1..196104bf 100644 --- a/flatlaf-testing/dumps/uidefaults/FlatLightLaf_1.8.0_202-mac.txt +++ b/flatlaf-testing/dumps/uidefaults/FlatLightLaf_1.8.0_202-mac.txt @@ -102,8 +102,8 @@ #---- light ---- -- light.font [active] Segoe UI Semilight plain 12 javax.swing.plaf.FontUIResource [UI] -+ light.font [active] HelveticaNeue-Light plain 13 javax.swing.plaf.FontUIResource [UI] +- light.font [active] Segoe UI Light plain 12 javax.swing.plaf.FontUIResource [UI] ++ light.font [active] HelveticaNeue-Thin plain 13 javax.swing.plaf.FontUIResource [UI] #---- medium ---- @@ -134,9 +134,3 @@ - small.font [active] Segoe UI plain 10 javax.swing.plaf.FontUIResource [UI] + small.font [active] Helvetica Neue plain 11 javax.swing.plaf.FontUIResource [UI] - - -#---- thin ---- - -- thin.font [active] Segoe UI Light plain 12 javax.swing.plaf.FontUIResource [UI] -+ thin.font [active] HelveticaNeue-Thin plain 13 javax.swing.plaf.FontUIResource [UI] diff --git a/flatlaf-testing/dumps/uidefaults/FlatLightLaf_1.8.0_202.txt b/flatlaf-testing/dumps/uidefaults/FlatLightLaf_1.8.0_202.txt index f1b76b09..f6748391 100644 --- a/flatlaf-testing/dumps/uidefaults/FlatLightLaf_1.8.0_202.txt +++ b/flatlaf-testing/dumps/uidefaults/FlatLightLaf_1.8.0_202.txt @@ -1401,7 +1401,6 @@ ViewportUI com.formdev.flatlaf.ui.FlatViewportUI [style].monospaced font: $monospaced.font [style].semibold font: $semibold.font [style].small font: $small.font -[style].thin font: $thin.font #---- ---- @@ -1477,7 +1476,7 @@ large.font [active] Segoe UI plain 14 javax.swing.plaf.Fo #---- light ---- -light.font [active] Segoe UI Semilight plain 12 javax.swing.plaf.FontUIResource [UI] +light.font [active] Segoe UI Light plain 12 javax.swing.plaf.FontUIResource [UI] #---- medium ---- @@ -1528,15 +1527,6 @@ textHighlight #2675bf HSL 209 67 45 javax.swing.plaf.Colo textHighlightText #ffffff HSL 0 0 100 javax.swing.plaf.ColorUIResource [UI] textInactiveText #8c8c8c HSL 0 0 55 javax.swing.plaf.ColorUIResource [UI] textText #000000 HSL 0 0 0 javax.swing.plaf.ColorUIResource [UI] - - -#---- thin ---- - -thin.font [active] Segoe UI Light plain 12 javax.swing.plaf.FontUIResource [UI] - - -#---- ---- - window #f2f2f2 HSL 0 0 95 javax.swing.plaf.ColorUIResource [UI] windowBorder #000000 HSL 0 0 0 javax.swing.plaf.ColorUIResource [UI] windowText #000000 HSL 0 0 0 javax.swing.plaf.ColorUIResource [UI] diff --git a/flatlaf-testing/dumps/uidefaults/FlatTestLaf_1.8.0_202.txt b/flatlaf-testing/dumps/uidefaults/FlatTestLaf_1.8.0_202.txt index efdc7525..f0770dfc 100644 --- a/flatlaf-testing/dumps/uidefaults/FlatTestLaf_1.8.0_202.txt +++ b/flatlaf-testing/dumps/uidefaults/FlatTestLaf_1.8.0_202.txt @@ -1405,7 +1405,6 @@ ViewportUI com.formdev.flatlaf.ui.FlatViewportUI [style].monospaced font: $monospaced.font [style].semibold font: $semibold.font [style].small font: $small.font -[style].thin font: $thin.font #---- ---- @@ -1481,7 +1480,7 @@ large.font [active] Segoe UI plain 14 javax.swing.plaf.Fo #---- light ---- -light.font [active] Segoe UI Semilight plain 12 javax.swing.plaf.FontUIResource [UI] +light.font [active] Segoe UI Light plain 12 javax.swing.plaf.FontUIResource [UI] #---- medium ---- @@ -1532,15 +1531,6 @@ textHighlight #00aa00 HSL 120 100 33 javax.swing.plaf.Colo textHighlightText #ffff00 HSL 60 100 50 javax.swing.plaf.ColorUIResource [UI] textInactiveText #000088 HSL 240 100 27 javax.swing.plaf.ColorUIResource [UI] textText #ff0000 HSL 0 100 50 javax.swing.plaf.ColorUIResource [UI] - - -#---- thin ---- - -thin.font [active] Segoe UI Light plain 12 javax.swing.plaf.FontUIResource [UI] - - -#---- ---- - window #ccffcc HSL 120 100 90 javax.swing.plaf.ColorUIResource [UI] windowBorder #ff0000 HSL 0 100 50 javax.swing.plaf.ColorUIResource [UI] windowText #ff0000 HSL 0 100 50 javax.swing.plaf.ColorUIResource [UI] 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 28a64367..9a8d2510 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 @@ -53,7 +53,6 @@ public class FlatThemePreviewFonts FlatThemePreviewFonts.FontPreview mediumPreview = new FlatThemePreviewFonts.FontPreview(); FlatThemePreviewFonts.FontPreview smallPreview = new FlatThemePreviewFonts.FontPreview(); FlatThemePreviewFonts.FontPreview miniPreview = new FlatThemePreviewFonts.FontPreview(); - FlatThemePreviewFonts.FontPreview thinPreview = new FlatThemePreviewFonts.FontPreview(); FlatThemePreviewFonts.FontPreview lightPreview = new FlatThemePreviewFonts.FontPreview(); FlatThemePreviewFonts.FontPreview semiboldPreview = new FlatThemePreviewFonts.FontPreview(); FlatThemePreviewFonts.FontPreview monospacedPreview = new FlatThemePreviewFonts.FontPreview(); @@ -80,7 +79,6 @@ public class FlatThemePreviewFonts "[bottom]" + "[bottom]para" + "[]" + - "[]" + "[]para" + "[]para" + "[]")); @@ -149,34 +147,29 @@ public class FlatThemePreviewFonts miniPreview.setFontStyle("mini"); add(miniPreview, "cell 0 12,gapx 12"); - //---- thinPreview ---- - thinPreview.setFontType("Thin"); - thinPreview.setFontStyle("thin"); - add(thinPreview, "cell 0 13,gapx 12"); - //---- lightPreview ---- lightPreview.setFontType("Light"); lightPreview.setFontStyle("light"); - add(lightPreview, "cell 0 14,gapx 12"); + add(lightPreview, "cell 0 13,gapx 12"); //---- semiboldPreview ---- semiboldPreview.setFontType("Semibold"); semiboldPreview.setFontStyle("semibold"); - add(semiboldPreview, "cell 0 15,gapx 12"); + add(semiboldPreview, "cell 0 14,gapx 12"); //---- monospacedPreview ---- monospacedPreview.setFontType("Monospaced"); monospacedPreview.setFontStyle("monospaced"); - add(monospacedPreview, "cell 0 16,gapx 12"); + add(monospacedPreview, "cell 0 15,gapx 12"); //---- scaleLabel ---- scaleLabel.setText("Fonts are scaled by:"); - add(scaleLabel, "cell 0 17,gapx 12"); + add(scaleLabel, "cell 0 16,gapx 12"); //---- scaleValueLabel ---- scaleValueLabel.setText("1x"); scaleValueLabel.putClientProperty("FlatLaf.styleClass", "h2"); - add(scaleValueLabel, "cell 0 17"); + add(scaleValueLabel, "cell 0 16"); // JFormDesigner - End of component initialization //GEN-END:initComponents } diff --git a/flatlaf-theme-editor/src/main/java/com/formdev/flatlaf/themeeditor/FlatThemePreviewFonts.jfd b/flatlaf-theme-editor/src/main/java/com/formdev/flatlaf/themeeditor/FlatThemePreviewFonts.jfd index eeda2887..002e1736 100644 --- a/flatlaf-theme-editor/src/main/java/com/formdev/flatlaf/themeeditor/FlatThemePreviewFonts.jfd +++ b/flatlaf-theme-editor/src/main/java/com/formdev/flatlaf/themeeditor/FlatThemePreviewFonts.jfd @@ -9,7 +9,7 @@ new FormModel { add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) { "$layoutConstraints": "ltr,insets dialog,hidemode 3" "$columnConstraints": "[left]unrel" - "$rowConstraints": "[][bottom][bottom][bottom][bottom][bottom][bottom]para[][bottom][bottom][bottom][bottom][bottom]para[][][]para[]para[]" + "$rowConstraints": "[][bottom][bottom][bottom][bottom][bottom][bottom]para[][bottom][bottom][bottom][bottom][bottom]para[][]para[]para[]" } ) { name: "this" add( new FormComponent( "javax.swing.JLabel" ) { @@ -105,39 +105,32 @@ new FormModel { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { "value": "cell 0 12,gapx 12" } ) - add( new FormComponent( "com.formdev.flatlaf.themeeditor.FlatThemePreviewFonts$FontPreview" ) { - name: "thinPreview" - "fontType": "Thin" - "fontStyle": "thin" - }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { - "value": "cell 0 13,gapx 12" - } ) add( new FormComponent( "com.formdev.flatlaf.themeeditor.FlatThemePreviewFonts$FontPreview" ) { name: "lightPreview" "fontType": "Light" "fontStyle": "light" }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { - "value": "cell 0 14,gapx 12" + "value": "cell 0 13,gapx 12" } ) add( new FormComponent( "com.formdev.flatlaf.themeeditor.FlatThemePreviewFonts$FontPreview" ) { name: "semiboldPreview" "fontType": "Semibold" "fontStyle": "semibold" }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { - "value": "cell 0 15,gapx 12" + "value": "cell 0 14,gapx 12" } ) add( new FormComponent( "com.formdev.flatlaf.themeeditor.FlatThemePreviewFonts$FontPreview" ) { name: "monospacedPreview" "fontType": "Monospaced" "fontStyle": "monospaced" }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { - "value": "cell 0 16,gapx 12" + "value": "cell 0 15,gapx 12" } ) add( new FormComponent( "javax.swing.JLabel" ) { name: "scaleLabel" "text": "Fonts are scaled by:" }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { - "value": "cell 0 17,gapx 12" + "value": "cell 0 16,gapx 12" } ) add( new FormComponent( "javax.swing.JLabel" ) { name: "scaleValueLabel" @@ -147,7 +140,7 @@ new FormModel { "JavaCodeGenerator.variableLocal": false } }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { - "value": "cell 0 17" + "value": "cell 0 16" } ) }, new FormLayoutConstraints( null ) { "location": new java.awt.Point( 5, 0 ) diff --git a/flatlaf-theme-editor/src/main/resources/com/formdev/flatlaf/themeeditor/FlatLafUIKeys.txt b/flatlaf-theme-editor/src/main/resources/com/formdev/flatlaf/themeeditor/FlatLafUIKeys.txt index 36850580..caa55b35 100644 --- a/flatlaf-theme-editor/src/main/resources/com/formdev/flatlaf/themeeditor/FlatLafUIKeys.txt +++ b/flatlaf-theme-editor/src/main/resources/com/formdev/flatlaf/themeeditor/FlatLafUIKeys.txt @@ -1077,7 +1077,6 @@ ViewportUI [style].monospaced [style].semibold [style].small -[style].thin activeCaption activeCaptionBorder activeCaptionText @@ -1120,7 +1119,6 @@ textHighlight textHighlightText textInactiveText textText -thin.font window windowBorder windowText From 5df3717d945888fac78f7fc7131108a5e58ffd91 Mon Sep 17 00:00:00 2001 From: Karl Tauber Date: Wed, 17 Nov 2021 00:25:38 +0100 Subject: [PATCH 19/22] Typography: added "Material Design 3" to FlatTypographyTest --- .../flatlaf/testing/FlatTypographyTest.java | 155 ++++++++++++---- .../flatlaf/testing/FlatTypographyTest.jfd | 171 ++++++++++++++---- 2 files changed, 258 insertions(+), 68 deletions(-) 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 055f642e..bd5abf3f 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 @@ -52,6 +52,7 @@ public class FlatTypographyTest JLabel label11 = new JLabel(); JLabel label72 = new JLabel(); JLabel label28 = new JLabel(); + JLabel label29 = new JLabel(); JLabel label1 = new JLabel(); JLabel label37 = new JLabel(); JLabel label46 = new JLabel(); @@ -63,14 +64,17 @@ public class FlatTypographyTest FlatTypographyTest.LinkLabel linkLabel4 = new FlatTypographyTest.LinkLabel(); FlatTypographyTest.LinkLabel linkLabel10 = new FlatTypographyTest.LinkLabel(); FlatTypographyTest.LinkLabel linkLabel8 = new FlatTypographyTest.LinkLabel(); + FlatTypographyTest.LinkLabel linkLabel11 = new FlatTypographyTest.LinkLabel(); FlatTypographyTest.LinkLabel linkLabel5 = new FlatTypographyTest.LinkLabel(); FlatTypographyTest.LinkLabel linkLabel6 = new FlatTypographyTest.LinkLabel(); FlatTypographyTest.LinkLabel linkLabel7 = new FlatTypographyTest.LinkLabel(); FlatTypographyTest.FontPreview fontPreview69 = new FlatTypographyTest.FontPreview(); FlatTypographyTest.FontPreview fontPreview93 = new FlatTypographyTest.FontPreview(); FlatTypographyTest.FontPreview fontPreview40 = new FlatTypographyTest.FontPreview(); + FlatTypographyTest.FontPreview fontPreview35 = new FlatTypographyTest.FontPreview(); FlatTypographyTest.FontPreview fontPreview85 = new FlatTypographyTest.FontPreview(); FlatTypographyTest.FontPreview fontPreview70 = new FlatTypographyTest.FontPreview(); + FlatTypographyTest.FontPreview fontPreview36 = new FlatTypographyTest.FontPreview(); FlatTypographyTest.FontPreview fontPreview51 = new FlatTypographyTest.FontPreview(); FlatTypographyTest.FontPreview fontPreview1 = new FlatTypographyTest.FontPreview(); FlatTypographyTest.FontPreview fontPreview11 = new FlatTypographyTest.FontPreview(); @@ -79,6 +83,7 @@ public class FlatTypographyTest FlatTypographyTest.FontPreview fontPreview41 = new FlatTypographyTest.FontPreview(); FlatTypographyTest.FontPreview fontPreview86 = new FlatTypographyTest.FontPreview(); FlatTypographyTest.FontPreview fontPreview71 = new FlatTypographyTest.FontPreview(); + FlatTypographyTest.FontPreview fontPreview37 = new FlatTypographyTest.FontPreview(); FlatTypographyTest.FontPreview fontPreview47 = new FlatTypographyTest.FontPreview(); FlatTypographyTest.FontPreview fontPreview54 = new FlatTypographyTest.FontPreview(); FlatTypographyTest.FontPreview fontPreview62 = new FlatTypographyTest.FontPreview(); @@ -90,6 +95,7 @@ public class FlatTypographyTest FlatTypographyTest.FontPreview fontPreview42 = new FlatTypographyTest.FontPreview(); FlatTypographyTest.FontPreview fontPreview87 = new FlatTypographyTest.FontPreview(); FlatTypographyTest.FontPreview fontPreview72 = new FlatTypographyTest.FontPreview(); + FlatTypographyTest.FontPreview fontPreview38 = new FlatTypographyTest.FontPreview(); FlatTypographyTest.FontPreview fontPreview48 = new FlatTypographyTest.FontPreview(); FlatTypographyTest.FontPreview fontPreview55 = new FlatTypographyTest.FontPreview(); FlatTypographyTest.FontPreview fontPreview63 = new FlatTypographyTest.FontPreview(); @@ -100,6 +106,7 @@ public class FlatTypographyTest FlatTypographyTest.FontPreview fontPreview43 = new FlatTypographyTest.FontPreview(); FlatTypographyTest.FontPreview fontPreview88 = new FlatTypographyTest.FontPreview(); FlatTypographyTest.FontPreview fontPreview73 = new FlatTypographyTest.FontPreview(); + FlatTypographyTest.FontPreview fontPreview79 = new FlatTypographyTest.FontPreview(); FlatTypographyTest.FontPreview fontPreview49 = new FlatTypographyTest.FontPreview(); FlatTypographyTest.FontPreview fontPreview57 = new FlatTypographyTest.FontPreview(); FlatTypographyTest.FontPreview fontPreview64 = new FlatTypographyTest.FontPreview(); @@ -109,6 +116,7 @@ public class FlatTypographyTest FlatTypographyTest.FontPreview fontPreview30 = new FlatTypographyTest.FontPreview(); FlatTypographyTest.FontPreview fontPreview89 = new FlatTypographyTest.FontPreview(); FlatTypographyTest.FontPreview fontPreview74 = new FlatTypographyTest.FontPreview(); + FlatTypographyTest.FontPreview fontPreview80 = new FlatTypographyTest.FontPreview(); FlatTypographyTest.FontPreview fontPreview50 = new FlatTypographyTest.FontPreview(); FlatTypographyTest.FontPreview fontPreview58 = new FlatTypographyTest.FontPreview(); FlatTypographyTest.FontPreview fontPreview65 = new FlatTypographyTest.FontPreview(); @@ -117,6 +125,7 @@ public class FlatTypographyTest FlatTypographyTest.FontPreview fontPreview23 = new FlatTypographyTest.FontPreview(); FlatTypographyTest.FontPreview fontPreview31 = new FlatTypographyTest.FontPreview(); FlatTypographyTest.FontPreview fontPreview44 = new FlatTypographyTest.FontPreview(); + FlatTypographyTest.FontPreview fontPreview81 = new FlatTypographyTest.FontPreview(); FlatTypographyTest.FontPreview fontPreview56 = new FlatTypographyTest.FontPreview(); FlatTypographyTest.FontPreview fontPreview66 = new FlatTypographyTest.FontPreview(); JSeparator separator1 = new JSeparator(); @@ -128,6 +137,7 @@ public class FlatTypographyTest FlatTypographyTest.FontPreview fontPreview45 = new FlatTypographyTest.FontPreview(); FlatTypographyTest.FontPreview fontPreview90 = new FlatTypographyTest.FontPreview(); FlatTypographyTest.FontPreview fontPreview75 = new FlatTypographyTest.FontPreview(); + FlatTypographyTest.FontPreview fontPreview82 = new FlatTypographyTest.FontPreview(); FlatTypographyTest.FontPreview fontPreview52 = new FlatTypographyTest.FontPreview(); FlatTypographyTest.FontPreview fontPreview59 = new FlatTypographyTest.FontPreview(); FlatTypographyTest.FontPreview fontPreview67 = new FlatTypographyTest.FontPreview(); @@ -138,6 +148,7 @@ public class FlatTypographyTest FlatTypographyTest.FontPreview fontPreview39 = new FlatTypographyTest.FontPreview(); FlatTypographyTest.FontPreview fontPreview91 = new FlatTypographyTest.FontPreview(); FlatTypographyTest.FontPreview fontPreview76 = new FlatTypographyTest.FontPreview(); + FlatTypographyTest.FontPreview fontPreview83 = new FlatTypographyTest.FontPreview(); FlatTypographyTest.FontPreview fontPreview9 = new FlatTypographyTest.FontPreview(); FlatTypographyTest.FontPreview fontPreview18 = new FlatTypographyTest.FontPreview(); FlatTypographyTest.FontPreview fontPreview26 = new FlatTypographyTest.FontPreview(); @@ -145,12 +156,14 @@ public class FlatTypographyTest FlatTypographyTest.FontPreview fontPreview46 = new FlatTypographyTest.FontPreview(); FlatTypographyTest.FontPreview fontPreview92 = new FlatTypographyTest.FontPreview(); FlatTypographyTest.FontPreview fontPreview77 = new FlatTypographyTest.FontPreview(); + FlatTypographyTest.FontPreview fontPreview84 = new FlatTypographyTest.FontPreview(); FlatTypographyTest.FontPreview fontPreview53 = new FlatTypographyTest.FontPreview(); FlatTypographyTest.FontPreview fontPreview60 = new FlatTypographyTest.FontPreview(); FlatTypographyTest.FontPreview fontPreview68 = new FlatTypographyTest.FontPreview(); FlatTypographyTest.FontPreview fontPreview10 = new FlatTypographyTest.FontPreview(); FlatTypographyTest.FontPreview fontPreview34 = new FlatTypographyTest.FontPreview(); FlatTypographyTest.FontPreview fontPreview78 = new FlatTypographyTest.FontPreview(); + FlatTypographyTest.FontPreview fontPreview94 = new FlatTypographyTest.FontPreview(); FlatTypographyTest.FontPreview fontPreview61 = new FlatTypographyTest.FontPreview(); //======== this ======== @@ -164,6 +177,7 @@ public class FlatTypographyTest "[left]unrel" + "[left]unrel" + "[left]unrel" + + "[fill]unrel" + "[left]unrel" + "[left]unrel" + "[left]unrel", @@ -220,20 +234,25 @@ public class FlatTypographyTest label28.putClientProperty("FlatLaf.styleClass", "h1"); add(label28, "cell 6 0"); + //---- label29 ---- + label29.setText("Material 3"); + label29.putClientProperty("FlatLaf.styleClass", "h1"); + add(label29, "cell 7 0"); + //---- label1 ---- label1.setText("SAP Fiori"); label1.putClientProperty("FlatLaf.styleClass", "h1"); - add(label1, "cell 7 0"); + add(label1, "cell 8 0"); //---- label37 ---- label37.setText("Atlassian"); label37.putClientProperty("FlatLaf.styleClass", "h1"); - add(label37, "cell 8 0"); + add(label37, "cell 9 0"); //---- label46 ---- label46.setText("Iris"); label46.putClientProperty("FlatLaf.styleClass", "h1"); - add(label46, "cell 9 0"); + add(label46, "cell 10 0"); //---- linkLabel9 ---- linkLabel9.setLink("https://www.formdev.com/flatlaf/typography/"); @@ -267,17 +286,21 @@ public class FlatTypographyTest linkLabel8.setLink("https://material.io/design/typography/the-type-system.html#type-scale"); add(linkLabel8, "cell 6 1"); + //---- linkLabel11 ---- + linkLabel11.setLink("https://m3.material.io/styles/typography/tokens"); + add(linkLabel11, "cell 7 1"); + //---- linkLabel5 ---- linkLabel5.setLink("https://experience.sap.com/fiori-design-web/typography/#headlines-and-font-styles-for-ui-controls"); - add(linkLabel5, "cell 7 1"); + add(linkLabel5, "cell 8 1"); //---- linkLabel6 ---- linkLabel6.setLink("https://atlassian.design/foundations/typography"); - add(linkLabel6, "cell 8 1"); + add(linkLabel6, "cell 9 1"); //---- linkLabel7 ---- linkLabel7.setLink("https://iris.alkamitech.com/foundations/typography.html"); - add(linkLabel7, "cell 9 1"); + add(linkLabel7, "cell 10 1"); //---- fontPreview69 ---- fontPreview69.setFontType("H1"); @@ -293,10 +316,16 @@ public class FlatTypographyTest //---- fontPreview40 ---- fontPreview40.setFontSize(68); - fontPreview40.setFontType("Display"); + fontPreview40.setFontType("Disp"); fontPreview40.setBaseSize(14); add(fontPreview40, "cell 4 2 1 2"); + //---- fontPreview35 ---- + fontPreview35.setFontType("Disp L"); + fontPreview35.setFontSize(57); + fontPreview35.setBaseSize(16); + add(fontPreview35, "cell 7 2"); + //---- fontPreview85 ---- fontPreview85.setFontSize(48); fontPreview85.setFontType("H00"); @@ -309,11 +338,17 @@ public class FlatTypographyTest fontPreview70.setBaseSize(16); add(fontPreview70, "cell 6 3"); + //---- fontPreview36 ---- + fontPreview36.setFontSize(45); + fontPreview36.setFontType("Disp M"); + fontPreview36.setBaseSize(16); + add(fontPreview36, "cell 7 3"); + //---- fontPreview51 ---- fontPreview51.setFontType("h900"); fontPreview51.setFontSize(35); fontPreview51.setBaseSize(14); - add(fontPreview51, "cell 8 3"); + add(fontPreview51, "cell 9 3"); //---- fontPreview1 ---- fontPreview1.setBaseSize(12); @@ -344,7 +379,7 @@ public class FlatTypographyTest add(fontPreview27, "cell 3 4"); //---- fontPreview41 ---- - fontPreview41.setFontType("Title Large"); + fontPreview41.setFontType("Title L"); fontPreview41.setFontSize(40); fontPreview41.setBaseSize(14); add(fontPreview41, "cell 4 4"); @@ -361,24 +396,30 @@ public class FlatTypographyTest fontPreview71.setBaseSize(16); add(fontPreview71, "cell 6 4"); + //---- fontPreview37 ---- + fontPreview37.setFontSize(36); + fontPreview37.setFontType("Display S"); + fontPreview37.setBaseSize(16); + add(fontPreview37, "cell 7 4"); + //---- fontPreview47 ---- fontPreview47.setFontType("Header 1"); fontPreview47.setFontSize(36); fontPreview47.setBaseSize(14); - add(fontPreview47, "cell 7 4"); + add(fontPreview47, "cell 8 4"); //---- fontPreview54 ---- fontPreview54.setBaseSize(14); fontPreview54.setFontType("h800"); fontPreview54.setFontSize(29); - add(fontPreview54, "cell 8 4"); + add(fontPreview54, "cell 9 4"); //---- fontPreview62 ---- fontPreview62.setBaseSize(16); fontPreview62.setFontSize(44); fontPreview62.setFontType("Hero"); - add(fontPreview62, "cell 9 4"); - add(separator3, "cell 0 5 10 1,growx"); + add(fontPreview62, "cell 10 4"); + add(separator3, "cell 0 5 11 1,growx"); //---- fontPreview2 ---- fontPreview2.setBaseSize(12); @@ -426,23 +467,29 @@ public class FlatTypographyTest fontPreview72.setBaseSize(16); add(fontPreview72, "cell 6 6"); + //---- fontPreview38 ---- + fontPreview38.setFontSize(32); + fontPreview38.setFontType("Headline L"); + fontPreview38.setBaseSize(16); + add(fontPreview38, "cell 7 6"); + //---- fontPreview48 ---- fontPreview48.setFontType("Header 2"); fontPreview48.setFontSize(24); fontPreview48.setBaseSize(14); - add(fontPreview48, "cell 7 6"); + add(fontPreview48, "cell 8 6"); //---- fontPreview55 ---- fontPreview55.setBaseSize(14); fontPreview55.setFontType("h700"); fontPreview55.setFontSize(24); - add(fontPreview55, "cell 8 6"); + add(fontPreview55, "cell 9 6"); //---- fontPreview63 ---- fontPreview63.setBaseSize(16); fontPreview63.setFontSize(32); fontPreview63.setFontType("H1"); - add(fontPreview63, "cell 9 6"); + add(fontPreview63, "cell 10 6"); //---- fontPreview3 ---- fontPreview3.setBaseSize(12); @@ -490,23 +537,29 @@ public class FlatTypographyTest fontPreview73.setBaseSize(16); add(fontPreview73, "cell 6 7"); + //---- fontPreview79 ---- + fontPreview79.setFontType("Headline M"); + fontPreview79.setFontSize(28); + fontPreview79.setBaseSize(16); + add(fontPreview79, "cell 7 7"); + //---- fontPreview49 ---- fontPreview49.setFontType("Header 3"); fontPreview49.setFontSize(20); fontPreview49.setBaseSize(14); - add(fontPreview49, "cell 7 7"); + add(fontPreview49, "cell 8 7"); //---- fontPreview57 ---- fontPreview57.setBaseSize(14); fontPreview57.setFontType("h600"); fontPreview57.setFontSize(20); - add(fontPreview57, "cell 8 7"); + add(fontPreview57, "cell 9 7"); //---- fontPreview64 ---- fontPreview64.setBaseSize(16); fontPreview64.setFontType("H2"); fontPreview64.setFontSize(24); - add(fontPreview64, "cell 9 7"); + add(fontPreview64, "cell 10 7"); //---- fontPreview4 ---- fontPreview4.setBaseSize(12); @@ -548,23 +601,29 @@ public class FlatTypographyTest fontPreview74.setBaseSize(16); add(fontPreview74, "cell 6 8"); + //---- fontPreview80 ---- + fontPreview80.setFontType("Headline S"); + fontPreview80.setFontSize(24); + fontPreview80.setBaseSize(16); + add(fontPreview80, "cell 7 8"); + //---- fontPreview50 ---- fontPreview50.setFontType("Header 4"); fontPreview50.setFontSize(18); fontPreview50.setBaseSize(14); - add(fontPreview50, "cell 7 8"); + add(fontPreview50, "cell 8 8"); //---- fontPreview58 ---- fontPreview58.setBaseSize(14); fontPreview58.setFontType("h500"); fontPreview58.setFontSize(16); - add(fontPreview58, "cell 8 8"); + add(fontPreview58, "cell 9 8"); //---- fontPreview65 ---- fontPreview65.setBaseSize(16); fontPreview65.setFontSize(20); fontPreview65.setFontType("H3"); - add(fontPreview65, "cell 9 8"); + add(fontPreview65, "cell 10 8"); //---- fontPreview5 ---- fontPreview5.setBaseSize(12); @@ -599,18 +658,24 @@ public class FlatTypographyTest fontPreview44.setBaseSize(14); add(fontPreview44, "cell 4 9"); + //---- fontPreview81 ---- + fontPreview81.setFontType("Title L"); + fontPreview81.setFontSize(22); + fontPreview81.setBaseSize(16); + add(fontPreview81, "cell 7 9"); + //---- fontPreview56 ---- fontPreview56.setFontType("Large Text / Header 5"); fontPreview56.setFontSize(16); fontPreview56.setBaseSize(14); - add(fontPreview56, "cell 7 9"); + add(fontPreview56, "cell 8 9"); //---- fontPreview66 ---- fontPreview66.setBaseSize(16); fontPreview66.setFontType("H4"); fontPreview66.setFontSize(18); - add(fontPreview66, "cell 9 9"); - add(separator1, "cell 0 10 10 1,growx"); + add(fontPreview66, "cell 10 9"); + add(separator1, "cell 0 10 11 1,growx"); //---- fontPreview7 ---- fontPreview7.setFontType("Default"); @@ -661,24 +726,30 @@ public class FlatTypographyTest fontPreview75.setBaseSize(16); add(fontPreview75, "cell 6 11"); + //---- fontPreview82 ---- + fontPreview82.setFontSize(16); + fontPreview82.setFontType("Body L / Title M"); + fontPreview82.setBaseSize(16); + add(fontPreview82, "cell 7 11"); + //---- fontPreview52 ---- fontPreview52.setFontType("Medium Text / Header 6"); fontPreview52.setFontSize(14); fontPreview52.setBaseSize(14); - add(fontPreview52, "cell 7 11"); + add(fontPreview52, "cell 8 11"); //---- fontPreview59 ---- fontPreview59.setBaseSize(14); fontPreview59.setFontSize(14); fontPreview59.setFontType("h400"); - add(fontPreview59, "cell 8 11"); + add(fontPreview59, "cell 9 11"); //---- fontPreview67 ---- fontPreview67.setBaseSize(16); fontPreview67.setFontSize(16); fontPreview67.setFontType("Body"); - add(fontPreview67, "cell 9 11"); - add(separator2, "cell 0 12 10 1,growx"); + add(fontPreview67, "cell 10 11"); + add(separator2, "cell 0 12 11 1,growx"); //---- fontPreview8 ---- fontPreview8.setFontType("Medium"); @@ -716,6 +787,12 @@ public class FlatTypographyTest fontPreview76.setBaseSize(16); add(fontPreview76, "cell 6 13"); + //---- fontPreview83 ---- + fontPreview83.setFontType("Body M / Title S / Label L"); + fontPreview83.setFontSize(14); + fontPreview83.setBaseSize(16); + add(fontPreview83, "cell 7 13"); + //---- fontPreview9 ---- fontPreview9.setFontType("Small"); fontPreview9.setFontSize(10); @@ -758,23 +835,29 @@ public class FlatTypographyTest fontPreview77.setBaseSize(16); add(fontPreview77, "cell 6 14"); + //---- fontPreview84 ---- + fontPreview84.setFontType("Body S / Label M"); + fontPreview84.setFontSize(12); + fontPreview84.setBaseSize(16); + add(fontPreview84, "cell 7 14"); + //---- fontPreview53 ---- fontPreview53.setFontType("Small Text"); fontPreview53.setFontSize(12); fontPreview53.setBaseSize(14); - add(fontPreview53, "cell 7 14"); + add(fontPreview53, "cell 8 14"); //---- fontPreview60 ---- fontPreview60.setBaseSize(14); fontPreview60.setFontType("h300 / h200"); fontPreview60.setFontSize(12); - add(fontPreview60, "cell 8 14"); + add(fontPreview60, "cell 9 14"); //---- fontPreview68 ---- fontPreview68.setBaseSize(16); fontPreview68.setFontType("Small"); fontPreview68.setFontSize(14); - add(fontPreview68, "cell 9 14"); + add(fontPreview68, "cell 10 14"); //---- fontPreview10 ---- fontPreview10.setFontType("Mini"); @@ -794,11 +877,17 @@ public class FlatTypographyTest fontPreview78.setBaseSize(16); add(fontPreview78, "cell 6 15"); + //---- fontPreview94 ---- + fontPreview94.setFontSize(11); + fontPreview94.setFontType("Label S"); + fontPreview94.setBaseSize(16); + add(fontPreview94, "cell 7 15"); + //---- fontPreview61 ---- fontPreview61.setBaseSize(14); fontPreview61.setFontSize(11); fontPreview61.setFontType("h100"); - add(fontPreview61, "cell 8 15"); + add(fontPreview61, "cell 9 15"); // JFormDesigner - End of component initialization //GEN-END:initComponents } diff --git a/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatTypographyTest.jfd b/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatTypographyTest.jfd index ba115f23..2200147a 100644 --- a/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatTypographyTest.jfd +++ b/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatTypographyTest.jfd @@ -8,7 +8,7 @@ new FormModel { } add( new FormContainer( "com.formdev.flatlaf.testing.FlatTestPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) { "$layoutConstraints": "ltr,insets dialog,hidemode 3" - "$columnConstraints": "[left]unrel[left]unrel[left]unrel[left]unrel[left]unrel[left]unrel[left]unrel[left]unrel[left]unrel[left]unrel" + "$columnConstraints": "[left]unrel[left]unrel[left]unrel[left]unrel[left]unrel[left]unrel[left]unrel[fill]unrel[left]unrel[left]unrel[left]unrel" "$rowConstraints": "[top][bottom][bottom][bottom][bottom][][bottom][bottom][bottom][bottom][][bottom][][bottom][bottom][bottom]" } ) { name: "this" @@ -61,26 +61,33 @@ new FormModel { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { "value": "cell 6 0" } ) + add( new FormComponent( "javax.swing.JLabel" ) { + name: "label29" + "text": "Material 3" + "$client.FlatLaf.styleClass": "h1" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 7 0" + } ) add( new FormComponent( "javax.swing.JLabel" ) { name: "label1" "text": "SAP Fiori" "$client.FlatLaf.styleClass": "h1" }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { - "value": "cell 7 0" + "value": "cell 8 0" } ) add( new FormComponent( "javax.swing.JLabel" ) { name: "label37" "text": "Atlassian" "$client.FlatLaf.styleClass": "h1" }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { - "value": "cell 8 0" + "value": "cell 9 0" } ) add( new FormComponent( "javax.swing.JLabel" ) { name: "label46" "text": "Iris" "$client.FlatLaf.styleClass": "h1" }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { - "value": "cell 9 0" + "value": "cell 10 0" } ) add( new FormComponent( "com.formdev.flatlaf.testing.FlatTypographyTest$LinkLabel" ) { name: "linkLabel9" @@ -130,23 +137,29 @@ new FormModel { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { "value": "cell 6 1" } ) + add( new FormComponent( "com.formdev.flatlaf.testing.FlatTypographyTest$LinkLabel" ) { + name: "linkLabel11" + "link": "https://m3.material.io/styles/typography/tokens" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 7 1" + } ) add( new FormComponent( "com.formdev.flatlaf.testing.FlatTypographyTest$LinkLabel" ) { name: "linkLabel5" "link": "https://experience.sap.com/fiori-design-web/typography/#headlines-and-font-styles-for-ui-controls" }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { - "value": "cell 7 1" + "value": "cell 8 1" } ) add( new FormComponent( "com.formdev.flatlaf.testing.FlatTypographyTest$LinkLabel" ) { name: "linkLabel6" "link": "https://atlassian.design/foundations/typography" }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { - "value": "cell 8 1" + "value": "cell 9 1" } ) add( new FormComponent( "com.formdev.flatlaf.testing.FlatTypographyTest$LinkLabel" ) { name: "linkLabel7" "link": "https://iris.alkamitech.com/foundations/typography.html" }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { - "value": "cell 9 1" + "value": "cell 10 1" } ) add( new FormComponent( "com.formdev.flatlaf.testing.FlatTypographyTest$FontPreview" ) { name: "fontPreview69" @@ -167,11 +180,19 @@ new FormModel { add( new FormComponent( "com.formdev.flatlaf.testing.FlatTypographyTest$FontPreview" ) { name: "fontPreview40" "fontSize": 68 - "fontType": "Display" + "fontType": "Disp" "baseSize": 14 }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { "value": "cell 4 2 1 2" } ) + add( new FormComponent( "com.formdev.flatlaf.testing.FlatTypographyTest$FontPreview" ) { + name: "fontPreview35" + "fontType": "Disp L" + "fontSize": 57 + "baseSize": 16 + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 7 2" + } ) add( new FormComponent( "com.formdev.flatlaf.testing.FlatTypographyTest$FontPreview" ) { name: "fontPreview85" "fontSize": 48 @@ -188,13 +209,21 @@ new FormModel { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { "value": "cell 6 3" } ) + add( new FormComponent( "com.formdev.flatlaf.testing.FlatTypographyTest$FontPreview" ) { + name: "fontPreview36" + "fontSize": 45 + "fontType": "Disp M" + "baseSize": 16 + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 7 3" + } ) add( new FormComponent( "com.formdev.flatlaf.testing.FlatTypographyTest$FontPreview" ) { name: "fontPreview51" "fontType": "h900" "fontSize": 35 "baseSize": 14 }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { - "value": "cell 8 3" + "value": "cell 9 3" } ) add( new FormComponent( "com.formdev.flatlaf.testing.FlatTypographyTest$FontPreview" ) { name: "fontPreview1" @@ -234,7 +263,7 @@ new FormModel { } ) add( new FormComponent( "com.formdev.flatlaf.testing.FlatTypographyTest$FontPreview" ) { name: "fontPreview41" - "fontType": "Title Large" + "fontType": "Title L" "fontSize": 40 "baseSize": 14 }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { @@ -256,13 +285,21 @@ new FormModel { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { "value": "cell 6 4" } ) + add( new FormComponent( "com.formdev.flatlaf.testing.FlatTypographyTest$FontPreview" ) { + name: "fontPreview37" + "fontSize": 36 + "fontType": "Display S" + "baseSize": 16 + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 7 4" + } ) add( new FormComponent( "com.formdev.flatlaf.testing.FlatTypographyTest$FontPreview" ) { name: "fontPreview47" "fontType": "Header 1" "fontSize": 36 "baseSize": 14 }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { - "value": "cell 7 4" + "value": "cell 8 4" } ) add( new FormComponent( "com.formdev.flatlaf.testing.FlatTypographyTest$FontPreview" ) { name: "fontPreview54" @@ -270,7 +307,7 @@ new FormModel { "fontType": "h800" "fontSize": 29 }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { - "value": "cell 8 4" + "value": "cell 9 4" } ) add( new FormComponent( "com.formdev.flatlaf.testing.FlatTypographyTest$FontPreview" ) { name: "fontPreview62" @@ -278,12 +315,12 @@ new FormModel { "fontSize": 44 "fontType": "Hero" }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { - "value": "cell 9 4" + "value": "cell 10 4" } ) add( new FormComponent( "javax.swing.JSeparator" ) { name: "separator3" }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { - "value": "cell 0 5 10 1,growx" + "value": "cell 0 5 11 1,growx" } ) add( new FormComponent( "com.formdev.flatlaf.testing.FlatTypographyTest$FontPreview" ) { name: "fontPreview2" @@ -345,13 +382,21 @@ new FormModel { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { "value": "cell 6 6" } ) + add( new FormComponent( "com.formdev.flatlaf.testing.FlatTypographyTest$FontPreview" ) { + name: "fontPreview38" + "fontSize": 32 + "fontType": "Headline L" + "baseSize": 16 + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 7 6" + } ) add( new FormComponent( "com.formdev.flatlaf.testing.FlatTypographyTest$FontPreview" ) { name: "fontPreview48" "fontType": "Header 2" "fontSize": 24 "baseSize": 14 }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { - "value": "cell 7 6" + "value": "cell 8 6" } ) add( new FormComponent( "com.formdev.flatlaf.testing.FlatTypographyTest$FontPreview" ) { name: "fontPreview55" @@ -359,7 +404,7 @@ new FormModel { "fontType": "h700" "fontSize": 24 }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { - "value": "cell 8 6" + "value": "cell 9 6" } ) add( new FormComponent( "com.formdev.flatlaf.testing.FlatTypographyTest$FontPreview" ) { name: "fontPreview63" @@ -367,7 +412,7 @@ new FormModel { "fontSize": 32 "fontType": "H1" }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { - "value": "cell 9 6" + "value": "cell 10 6" } ) add( new FormComponent( "com.formdev.flatlaf.testing.FlatTypographyTest$FontPreview" ) { name: "fontPreview3" @@ -429,13 +474,21 @@ new FormModel { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { "value": "cell 6 7" } ) + add( new FormComponent( "com.formdev.flatlaf.testing.FlatTypographyTest$FontPreview" ) { + name: "fontPreview79" + "fontType": "Headline M" + "fontSize": 28 + "baseSize": 16 + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 7 7" + } ) add( new FormComponent( "com.formdev.flatlaf.testing.FlatTypographyTest$FontPreview" ) { name: "fontPreview49" "fontType": "Header 3" "fontSize": 20 "baseSize": 14 }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { - "value": "cell 7 7" + "value": "cell 8 7" } ) add( new FormComponent( "com.formdev.flatlaf.testing.FlatTypographyTest$FontPreview" ) { name: "fontPreview57" @@ -443,7 +496,7 @@ new FormModel { "fontType": "h600" "fontSize": 20 }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { - "value": "cell 8 7" + "value": "cell 9 7" } ) add( new FormComponent( "com.formdev.flatlaf.testing.FlatTypographyTest$FontPreview" ) { name: "fontPreview64" @@ -451,7 +504,7 @@ new FormModel { "fontType": "H2" "fontSize": 24 }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { - "value": "cell 9 7" + "value": "cell 10 7" } ) add( new FormComponent( "com.formdev.flatlaf.testing.FlatTypographyTest$FontPreview" ) { name: "fontPreview4" @@ -505,13 +558,21 @@ new FormModel { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { "value": "cell 6 8" } ) + add( new FormComponent( "com.formdev.flatlaf.testing.FlatTypographyTest$FontPreview" ) { + name: "fontPreview80" + "fontType": "Headline S" + "fontSize": 24 + "baseSize": 16 + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 7 8" + } ) add( new FormComponent( "com.formdev.flatlaf.testing.FlatTypographyTest$FontPreview" ) { name: "fontPreview50" "fontType": "Header 4" "fontSize": 18 "baseSize": 14 }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { - "value": "cell 7 8" + "value": "cell 8 8" } ) add( new FormComponent( "com.formdev.flatlaf.testing.FlatTypographyTest$FontPreview" ) { name: "fontPreview58" @@ -519,7 +580,7 @@ new FormModel { "fontType": "h500" "fontSize": 16 }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { - "value": "cell 8 8" + "value": "cell 9 8" } ) add( new FormComponent( "com.formdev.flatlaf.testing.FlatTypographyTest$FontPreview" ) { name: "fontPreview65" @@ -527,7 +588,7 @@ new FormModel { "fontSize": 20 "fontType": "H3" }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { - "value": "cell 9 8" + "value": "cell 10 8" } ) add( new FormComponent( "com.formdev.flatlaf.testing.FlatTypographyTest$FontPreview" ) { name: "fontPreview5" @@ -572,13 +633,21 @@ new FormModel { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { "value": "cell 4 9" } ) + add( new FormComponent( "com.formdev.flatlaf.testing.FlatTypographyTest$FontPreview" ) { + name: "fontPreview81" + "fontType": "Title L" + "fontSize": 22 + "baseSize": 16 + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 7 9" + } ) add( new FormComponent( "com.formdev.flatlaf.testing.FlatTypographyTest$FontPreview" ) { name: "fontPreview56" "fontType": "Large Text / Header 5" "fontSize": 16 "baseSize": 14 }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { - "value": "cell 7 9" + "value": "cell 8 9" } ) add( new FormComponent( "com.formdev.flatlaf.testing.FlatTypographyTest$FontPreview" ) { name: "fontPreview66" @@ -586,12 +655,12 @@ new FormModel { "fontType": "H4" "fontSize": 18 }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { - "value": "cell 9 9" + "value": "cell 10 9" } ) add( new FormComponent( "javax.swing.JSeparator" ) { name: "separator1" }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { - "value": "cell 0 10 10 1,growx" + "value": "cell 0 10 11 1,growx" } ) add( new FormComponent( "com.formdev.flatlaf.testing.FlatTypographyTest$FontPreview" ) { name: "fontPreview7" @@ -658,13 +727,21 @@ new FormModel { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { "value": "cell 6 11" } ) + add( new FormComponent( "com.formdev.flatlaf.testing.FlatTypographyTest$FontPreview" ) { + name: "fontPreview82" + "fontSize": 16 + "fontType": "Body L / Title M" + "baseSize": 16 + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 7 11" + } ) add( new FormComponent( "com.formdev.flatlaf.testing.FlatTypographyTest$FontPreview" ) { name: "fontPreview52" "fontType": "Medium Text / Header 6" "fontSize": 14 "baseSize": 14 }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { - "value": "cell 7 11" + "value": "cell 8 11" } ) add( new FormComponent( "com.formdev.flatlaf.testing.FlatTypographyTest$FontPreview" ) { name: "fontPreview59" @@ -672,7 +749,7 @@ new FormModel { "fontSize": 14 "fontType": "h400" }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { - "value": "cell 8 11" + "value": "cell 9 11" } ) add( new FormComponent( "com.formdev.flatlaf.testing.FlatTypographyTest$FontPreview" ) { name: "fontPreview67" @@ -680,12 +757,12 @@ new FormModel { "fontSize": 16 "fontType": "Body" }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { - "value": "cell 9 11" + "value": "cell 10 11" } ) add( new FormComponent( "javax.swing.JSeparator" ) { name: "separator2" }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { - "value": "cell 0 12 10 1,growx" + "value": "cell 0 12 11 1,growx" } ) add( new FormComponent( "com.formdev.flatlaf.testing.FlatTypographyTest$FontPreview" ) { name: "fontPreview8" @@ -735,6 +812,14 @@ new FormModel { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { "value": "cell 6 13" } ) + add( new FormComponent( "com.formdev.flatlaf.testing.FlatTypographyTest$FontPreview" ) { + name: "fontPreview83" + "fontType": "Body M / Title S / Label L" + "fontSize": 14 + "baseSize": 16 + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 7 13" + } ) add( new FormComponent( "com.formdev.flatlaf.testing.FlatTypographyTest$FontPreview" ) { name: "fontPreview9" "fontType": "Small" @@ -791,13 +876,21 @@ new FormModel { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { "value": "cell 6 14" } ) + add( new FormComponent( "com.formdev.flatlaf.testing.FlatTypographyTest$FontPreview" ) { + name: "fontPreview84" + "fontType": "Body S / Label M" + "fontSize": 12 + "baseSize": 16 + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 7 14" + } ) add( new FormComponent( "com.formdev.flatlaf.testing.FlatTypographyTest$FontPreview" ) { name: "fontPreview53" "fontType": "Small Text" "fontSize": 12 "baseSize": 14 }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { - "value": "cell 7 14" + "value": "cell 8 14" } ) add( new FormComponent( "com.formdev.flatlaf.testing.FlatTypographyTest$FontPreview" ) { name: "fontPreview60" @@ -805,7 +898,7 @@ new FormModel { "fontType": "h300 / h200" "fontSize": 12 }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { - "value": "cell 8 14" + "value": "cell 9 14" } ) add( new FormComponent( "com.formdev.flatlaf.testing.FlatTypographyTest$FontPreview" ) { name: "fontPreview68" @@ -813,7 +906,7 @@ new FormModel { "fontType": "Small" "fontSize": 14 }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { - "value": "cell 9 14" + "value": "cell 10 14" } ) add( new FormComponent( "com.formdev.flatlaf.testing.FlatTypographyTest$FontPreview" ) { name: "fontPreview10" @@ -839,17 +932,25 @@ new FormModel { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { "value": "cell 6 15" } ) + add( new FormComponent( "com.formdev.flatlaf.testing.FlatTypographyTest$FontPreview" ) { + name: "fontPreview94" + "fontSize": 11 + "fontType": "Label S" + "baseSize": 16 + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 7 15" + } ) add( new FormComponent( "com.formdev.flatlaf.testing.FlatTypographyTest$FontPreview" ) { name: "fontPreview61" "baseSize": 14 "fontSize": 11 "fontType": "h100" }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { - "value": "cell 8 15" + "value": "cell 9 15" } ) }, new FormLayoutConstraints( null ) { "location": new java.awt.Point( 5, 0 ) - "size": new java.awt.Dimension( 1430, 855 ) + "size": new java.awt.Dimension( 1500, 855 ) } ) add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) { "$layoutConstraints": "insets 0,hidemode 3" From f80d2bacf4876c7b1c95f3300ba42f48cba13c4a Mon Sep 17 00:00:00 2001 From: Karl Tauber Date: Wed, 17 Nov 2021 19:39:51 +0100 Subject: [PATCH 20/22] Typography: use light and semibold in FlatTypographyTest --- .../flatlaf/demo/BasicComponentsPanel.java | 2 +- .../flatlaf/demo/BasicComponentsPanel.jfd | 2 +- .../flatlaf/testing/FlatTypographyTest.java | 111 ++++++++++++++++-- .../flatlaf/testing/FlatTypographyTest.jfd | 68 ++++++++++- 4 files changed, 166 insertions(+), 17 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 89b6fd3c..02455ce9 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 @@ -745,7 +745,7 @@ class BasicComponentsPanel add(largeLabel, "cell 1 16 5 1"); //---- defaultLabel ---- - defaultLabel.setText("default/regular"); + defaultLabel.setText("default"); add(defaultLabel, "cell 1 16 5 1"); //---- mediumLabel ---- diff --git a/flatlaf-demo/src/main/java/com/formdev/flatlaf/demo/BasicComponentsPanel.jfd b/flatlaf-demo/src/main/java/com/formdev/flatlaf/demo/BasicComponentsPanel.jfd index f6f76f98..f1a7e69a 100644 --- a/flatlaf-demo/src/main/java/com/formdev/flatlaf/demo/BasicComponentsPanel.jfd +++ b/flatlaf-demo/src/main/java/com/formdev/flatlaf/demo/BasicComponentsPanel.jfd @@ -750,7 +750,7 @@ new FormModel { } ) add( new FormComponent( "javax.swing.JLabel" ) { name: "defaultLabel" - "text": "default/regular" + "text": "default" }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { "value": "cell 1 16 5 1" } ) 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 bd5abf3f..cc8a5f42 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 @@ -136,8 +136,10 @@ public class FlatTypographyTest FlatTypographyTest.FontPreview fontPreview32 = new FlatTypographyTest.FontPreview(); FlatTypographyTest.FontPreview fontPreview45 = new FlatTypographyTest.FontPreview(); FlatTypographyTest.FontPreview fontPreview90 = new FlatTypographyTest.FontPreview(); + FlatTypographyTest.FontPreview fontPreview98 = new FlatTypographyTest.FontPreview(); FlatTypographyTest.FontPreview fontPreview75 = new FlatTypographyTest.FontPreview(); FlatTypographyTest.FontPreview fontPreview82 = new FlatTypographyTest.FontPreview(); + FlatTypographyTest.FontPreview fontPreview95 = new FlatTypographyTest.FontPreview(); FlatTypographyTest.FontPreview fontPreview52 = new FlatTypographyTest.FontPreview(); FlatTypographyTest.FontPreview fontPreview59 = new FlatTypographyTest.FontPreview(); FlatTypographyTest.FontPreview fontPreview67 = new FlatTypographyTest.FontPreview(); @@ -149,6 +151,7 @@ public class FlatTypographyTest FlatTypographyTest.FontPreview fontPreview91 = new FlatTypographyTest.FontPreview(); FlatTypographyTest.FontPreview fontPreview76 = new FlatTypographyTest.FontPreview(); FlatTypographyTest.FontPreview fontPreview83 = new FlatTypographyTest.FontPreview(); + FlatTypographyTest.FontPreview fontPreview96 = new FlatTypographyTest.FontPreview(); FlatTypographyTest.FontPreview fontPreview9 = new FlatTypographyTest.FontPreview(); FlatTypographyTest.FontPreview fontPreview18 = new FlatTypographyTest.FontPreview(); FlatTypographyTest.FontPreview fontPreview26 = new FlatTypographyTest.FontPreview(); @@ -157,6 +160,7 @@ public class FlatTypographyTest FlatTypographyTest.FontPreview fontPreview92 = new FlatTypographyTest.FontPreview(); FlatTypographyTest.FontPreview fontPreview77 = new FlatTypographyTest.FontPreview(); FlatTypographyTest.FontPreview fontPreview84 = new FlatTypographyTest.FontPreview(); + FlatTypographyTest.FontPreview fontPreview97 = new FlatTypographyTest.FontPreview(); FlatTypographyTest.FontPreview fontPreview53 = new FlatTypographyTest.FontPreview(); FlatTypographyTest.FontPreview fontPreview60 = new FlatTypographyTest.FontPreview(); FlatTypographyTest.FontPreview fontPreview68 = new FlatTypographyTest.FontPreview(); @@ -306,6 +310,7 @@ public class FlatTypographyTest fontPreview69.setFontType("H1"); fontPreview69.setFontSize(96); fontPreview69.setBaseSize(16); + fontPreview69.setLight(true); add(fontPreview69, "cell 6 2"); //---- fontPreview93 ---- @@ -318,6 +323,7 @@ public class FlatTypographyTest fontPreview40.setFontSize(68); fontPreview40.setFontType("Disp"); fontPreview40.setBaseSize(14); + fontPreview40.setSemibold(true); add(fontPreview40, "cell 4 2 1 2"); //---- fontPreview35 ---- @@ -330,12 +336,14 @@ public class FlatTypographyTest fontPreview85.setFontSize(48); fontPreview85.setFontType("H00"); fontPreview85.setBaseSize(16); + fontPreview85.setSemibold(true); add(fontPreview85, "cell 5 3"); //---- fontPreview70 ---- fontPreview70.setFontSize(60); fontPreview70.setFontType("H2"); fontPreview70.setBaseSize(16); + fontPreview70.setLight(true); add(fontPreview70, "cell 6 3"); //---- fontPreview36 ---- @@ -348,6 +356,7 @@ public class FlatTypographyTest fontPreview51.setFontType("h900"); fontPreview51.setFontSize(35); fontPreview51.setBaseSize(14); + fontPreview51.setSemibold(true); add(fontPreview51, "cell 9 3"); //---- fontPreview1 ---- @@ -382,12 +391,14 @@ public class FlatTypographyTest fontPreview41.setFontType("Title L"); fontPreview41.setFontSize(40); fontPreview41.setBaseSize(14); + fontPreview41.setSemibold(true); add(fontPreview41, "cell 4 4"); //---- fontPreview86 ---- fontPreview86.setFontSize(40); fontPreview86.setFontType("H0"); fontPreview86.setBaseSize(16); + fontPreview86.setSemibold(true); add(fontPreview86, "cell 5 4"); //---- fontPreview71 ---- @@ -412,6 +423,7 @@ public class FlatTypographyTest fontPreview54.setBaseSize(14); fontPreview54.setFontType("h800"); fontPreview54.setFontSize(29); + fontPreview54.setSemibold(true); add(fontPreview54, "cell 9 4"); //---- fontPreview62 ---- @@ -453,12 +465,14 @@ public class FlatTypographyTest fontPreview42.setFontType("Title"); fontPreview42.setFontSize(28); fontPreview42.setBaseSize(14); + fontPreview42.setSemibold(true); add(fontPreview42, "cell 4 6"); //---- fontPreview87 ---- fontPreview87.setFontType("H1"); fontPreview87.setFontSize(32); fontPreview87.setBaseSize(16); + fontPreview87.setSemibold(true); add(fontPreview87, "cell 5 6"); //---- fontPreview72 ---- @@ -483,6 +497,7 @@ public class FlatTypographyTest fontPreview55.setBaseSize(14); fontPreview55.setFontType("h700"); fontPreview55.setFontSize(24); + fontPreview55.setSemibold(true); add(fontPreview55, "cell 9 6"); //---- fontPreview63 ---- @@ -523,12 +538,14 @@ public class FlatTypographyTest fontPreview43.setFontType("Subtitle"); fontPreview43.setFontSize(20); fontPreview43.setBaseSize(14); + fontPreview43.setSemibold(true); add(fontPreview43, "cell 4 7"); //---- fontPreview88 ---- fontPreview88.setFontSize(24); fontPreview88.setFontType("H2"); fontPreview88.setBaseSize(16); + fontPreview88.setSemibold(true); add(fontPreview88, "cell 5 7"); //---- fontPreview73 ---- @@ -553,6 +570,7 @@ public class FlatTypographyTest fontPreview57.setBaseSize(14); fontPreview57.setFontType("h600"); fontPreview57.setFontSize(20); + fontPreview57.setSemibold(true); add(fontPreview57, "cell 9 7"); //---- fontPreview64 ---- @@ -593,12 +611,14 @@ public class FlatTypographyTest fontPreview89.setFontType("H3"); fontPreview89.setFontSize(20); fontPreview89.setBaseSize(16); + fontPreview89.setSemibold(true); add(fontPreview89, "cell 5 8"); //---- fontPreview74 ---- fontPreview74.setFontType("H6"); fontPreview74.setFontSize(20); fontPreview74.setBaseSize(16); + fontPreview74.setSemibold(true); add(fontPreview74, "cell 6 8"); //---- fontPreview80 ---- @@ -617,6 +637,7 @@ public class FlatTypographyTest fontPreview58.setBaseSize(14); fontPreview58.setFontType("h500"); fontPreview58.setFontSize(16); + fontPreview58.setSemibold(true); add(fontPreview58, "cell 9 8"); //---- fontPreview65 ---- @@ -662,6 +683,7 @@ public class FlatTypographyTest fontPreview81.setFontType("Title L"); fontPreview81.setFontSize(22); fontPreview81.setBaseSize(16); + fontPreview81.setSemibold(true); add(fontPreview81, "cell 7 9"); //---- fontPreview56 ---- @@ -716,9 +738,16 @@ public class FlatTypographyTest //---- fontPreview90 ---- fontPreview90.setFontSize(16); - fontPreview90.setFontType("Body / H4"); + fontPreview90.setFontType("Body /"); fontPreview90.setBaseSize(16); - add(fontPreview90, "cell 5 11"); + add(fontPreview90, "cell 5 11,alignx left,growx 0"); + + //---- fontPreview98 ---- + fontPreview98.setFontSize(16); + fontPreview98.setFontType("H4"); + fontPreview98.setBaseSize(16); + fontPreview98.setSemibold(true); + add(fontPreview98, "cell 5 11"); //---- fontPreview75 ---- fontPreview75.setFontSize(16); @@ -728,9 +757,16 @@ public class FlatTypographyTest //---- fontPreview82 ---- fontPreview82.setFontSize(16); - fontPreview82.setFontType("Body L / Title M"); + fontPreview82.setFontType("Body L /"); fontPreview82.setBaseSize(16); - add(fontPreview82, "cell 7 11"); + add(fontPreview82, "cell 7 11,alignx left,growx 0"); + + //---- fontPreview95 ---- + fontPreview95.setFontSize(16); + fontPreview95.setFontType("Title M"); + fontPreview95.setBaseSize(16); + fontPreview95.setSemibold(true); + add(fontPreview95, "cell 7 11"); //---- fontPreview52 ---- fontPreview52.setFontType("Medium Text / Header 6"); @@ -742,6 +778,7 @@ public class FlatTypographyTest fontPreview59.setBaseSize(14); fontPreview59.setFontSize(14); fontPreview59.setFontType("h400"); + fontPreview59.setSemibold(true); add(fontPreview59, "cell 9 11"); //---- fontPreview67 ---- @@ -779,6 +816,7 @@ public class FlatTypographyTest fontPreview91.setFontType("H5"); fontPreview91.setFontSize(14); fontPreview91.setBaseSize(16); + fontPreview91.setSemibold(true); add(fontPreview91, "cell 5 13"); //---- fontPreview76 ---- @@ -788,10 +826,17 @@ public class FlatTypographyTest add(fontPreview76, "cell 6 13"); //---- fontPreview83 ---- - fontPreview83.setFontType("Body M / Title S / Label L"); + fontPreview83.setFontType("Body M /"); fontPreview83.setFontSize(14); fontPreview83.setBaseSize(16); - add(fontPreview83, "cell 7 13"); + add(fontPreview83, "cell 7 13,alignx left,growx 0"); + + //---- fontPreview96 ---- + fontPreview96.setFontType("Title S / Label L"); + fontPreview96.setFontSize(14); + fontPreview96.setBaseSize(16); + fontPreview96.setSemibold(true); + add(fontPreview96, "cell 7 13"); //---- fontPreview9 ---- fontPreview9.setFontType("Small"); @@ -827,6 +872,7 @@ public class FlatTypographyTest fontPreview92.setFontSize(12); fontPreview92.setFontType("H6"); fontPreview92.setBaseSize(12); + fontPreview92.setSemibold(true); add(fontPreview92, "cell 5 14"); //---- fontPreview77 ---- @@ -836,10 +882,17 @@ public class FlatTypographyTest add(fontPreview77, "cell 6 14"); //---- fontPreview84 ---- - fontPreview84.setFontType("Body S / Label M"); + fontPreview84.setFontType("Body S /"); fontPreview84.setFontSize(12); fontPreview84.setBaseSize(16); - add(fontPreview84, "cell 7 14"); + add(fontPreview84, "cell 7 14,alignx left,growx 0"); + + //---- fontPreview97 ---- + fontPreview97.setFontType("Label M"); + fontPreview97.setFontSize(12); + fontPreview97.setBaseSize(16); + fontPreview97.setSemibold(true); + add(fontPreview97, "cell 7 14"); //---- fontPreview53 ---- fontPreview53.setFontType("Small Text"); @@ -851,6 +904,7 @@ public class FlatTypographyTest fontPreview60.setBaseSize(14); fontPreview60.setFontType("h300 / h200"); fontPreview60.setFontSize(12); + fontPreview60.setSemibold(true); add(fontPreview60, "cell 9 14"); //---- fontPreview68 ---- @@ -881,12 +935,14 @@ public class FlatTypographyTest fontPreview94.setFontSize(11); fontPreview94.setFontType("Label S"); fontPreview94.setBaseSize(16); + fontPreview94.setSemibold(true); add(fontPreview94, "cell 7 15"); //---- fontPreview61 ---- fontPreview61.setBaseSize(14); fontPreview61.setFontSize(11); fontPreview61.setFontType("h100"); + fontPreview61.setSemibold(true); add(fontPreview61, "cell 9 15"); // JFormDesigner - End of component initialization //GEN-END:initComponents } @@ -945,6 +1001,8 @@ public class FlatTypographyTest private String fontType; private int fontSize; private int baseSize; + private boolean light; + private boolean semibold; private boolean bold; private boolean showPlain; @@ -982,6 +1040,26 @@ public class FlatTypographyTest updateDescription(); } + public boolean isLight() { + return light; + } + + public void setLight( boolean light ) { + this.light = light; + updateFont(); + updateDescription(); + } + + public boolean isSemibold() { + return semibold; + } + + public void setSemibold( boolean semibold ) { + this.semibold = semibold; + updateFont(); + updateDescription(); + } + public boolean isBold() { return bold; } @@ -1002,7 +1080,7 @@ public class FlatTypographyTest } private void updateFont() { - Font defaultFont = getDefaultFont(); + Font defaultFont = getBaseFont(); previewLabel.setFont( defaultFont.deriveFont( bold ? Font.BOLD : Font.PLAIN, fontSize ) ); preview2Label.setFont( defaultFont.deriveFont( Font.PLAIN, fontSize ) ); } @@ -1014,13 +1092,24 @@ public class FlatTypographyTest buf.append( " " ).append( fontSize > baseSize ? "+" : "" ).append( fontSize - baseSize ); buf.append( String.format( " %.2fx", (float) fontSize / baseSize ) ); } + if( light ) + buf.append( " light" ); + if( semibold ) + buf.append( " semibold" ); if( bold ) buf.append( " bold" ); descLabel.setText( buf.toString() ); } - private Font getDefaultFont() { - Font font = UIManager.getFont( "defaultFont" ); + private Font getBaseFont() { + Font font = null; + if( light ) + font = UIManager.getFont( "light.font" ); + else if( semibold ) + font = UIManager.getFont( "semibold.font" ); + + if( font == null ) + font = UIManager.getFont( "defaultFont" ); if( font == null ) font = UIManager.getFont( "Label.font" ); return font; diff --git a/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatTypographyTest.jfd b/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatTypographyTest.jfd index 2200147a..b928b42c 100644 --- a/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatTypographyTest.jfd +++ b/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatTypographyTest.jfd @@ -166,6 +166,7 @@ new FormModel { "fontType": "H1" "fontSize": 96 "baseSize": 16 + "light": true }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { "value": "cell 6 2" } ) @@ -182,6 +183,7 @@ new FormModel { "fontSize": 68 "fontType": "Disp" "baseSize": 14 + "semibold": true }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { "value": "cell 4 2 1 2" } ) @@ -198,6 +200,7 @@ new FormModel { "fontSize": 48 "fontType": "H00" "baseSize": 16 + "semibold": true }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { "value": "cell 5 3" } ) @@ -206,6 +209,7 @@ new FormModel { "fontSize": 60 "fontType": "H2" "baseSize": 16 + "light": true }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { "value": "cell 6 3" } ) @@ -222,6 +226,7 @@ new FormModel { "fontType": "h900" "fontSize": 35 "baseSize": 14 + "semibold": true }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { "value": "cell 9 3" } ) @@ -266,6 +271,7 @@ new FormModel { "fontType": "Title L" "fontSize": 40 "baseSize": 14 + "semibold": true }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { "value": "cell 4 4" } ) @@ -274,6 +280,7 @@ new FormModel { "fontSize": 40 "fontType": "H0" "baseSize": 16 + "semibold": true }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { "value": "cell 5 4" } ) @@ -306,6 +313,7 @@ new FormModel { "baseSize": 14 "fontType": "h800" "fontSize": 29 + "semibold": true }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { "value": "cell 9 4" } ) @@ -363,6 +371,7 @@ new FormModel { "fontType": "Title" "fontSize": 28 "baseSize": 14 + "semibold": true }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { "value": "cell 4 6" } ) @@ -371,6 +380,7 @@ new FormModel { "fontType": "H1" "fontSize": 32 "baseSize": 16 + "semibold": true }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { "value": "cell 5 6" } ) @@ -403,6 +413,7 @@ new FormModel { "baseSize": 14 "fontType": "h700" "fontSize": 24 + "semibold": true }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { "value": "cell 9 6" } ) @@ -455,6 +466,7 @@ new FormModel { "fontType": "Subtitle" "fontSize": 20 "baseSize": 14 + "semibold": true }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { "value": "cell 4 7" } ) @@ -463,6 +475,7 @@ new FormModel { "fontSize": 24 "fontType": "H2" "baseSize": 16 + "semibold": true }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { "value": "cell 5 7" } ) @@ -495,6 +508,7 @@ new FormModel { "baseSize": 14 "fontType": "h600" "fontSize": 20 + "semibold": true }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { "value": "cell 9 7" } ) @@ -547,6 +561,7 @@ new FormModel { "fontType": "H3" "fontSize": 20 "baseSize": 16 + "semibold": true }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { "value": "cell 5 8" } ) @@ -555,6 +570,7 @@ new FormModel { "fontType": "H6" "fontSize": 20 "baseSize": 16 + "semibold": true }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { "value": "cell 6 8" } ) @@ -579,6 +595,7 @@ new FormModel { "baseSize": 14 "fontType": "h500" "fontSize": 16 + "semibold": true }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { "value": "cell 9 8" } ) @@ -638,6 +655,7 @@ new FormModel { "fontType": "Title L" "fontSize": 22 "baseSize": 16 + "semibold": true }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { "value": "cell 7 9" } ) @@ -714,8 +732,17 @@ new FormModel { add( new FormComponent( "com.formdev.flatlaf.testing.FlatTypographyTest$FontPreview" ) { name: "fontPreview90" "fontSize": 16 - "fontType": "Body / H4" + "fontType": "Body /" "baseSize": 16 + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 5 11,alignx left,growx 0" + } ) + add( new FormComponent( "com.formdev.flatlaf.testing.FlatTypographyTest$FontPreview" ) { + name: "fontPreview98" + "fontSize": 16 + "fontType": "H4" + "baseSize": 16 + "semibold": true }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { "value": "cell 5 11" } ) @@ -730,8 +757,17 @@ new FormModel { add( new FormComponent( "com.formdev.flatlaf.testing.FlatTypographyTest$FontPreview" ) { name: "fontPreview82" "fontSize": 16 - "fontType": "Body L / Title M" + "fontType": "Body L /" "baseSize": 16 + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 7 11,alignx left,growx 0" + } ) + add( new FormComponent( "com.formdev.flatlaf.testing.FlatTypographyTest$FontPreview" ) { + name: "fontPreview95" + "fontSize": 16 + "fontType": "Title M" + "baseSize": 16 + "semibold": true }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { "value": "cell 7 11" } ) @@ -748,6 +784,7 @@ new FormModel { "baseSize": 14 "fontSize": 14 "fontType": "h400" + "semibold": true }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { "value": "cell 9 11" } ) @@ -801,6 +838,7 @@ new FormModel { "fontType": "H5" "fontSize": 14 "baseSize": 16 + "semibold": true }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { "value": "cell 5 13" } ) @@ -814,9 +852,18 @@ new FormModel { } ) add( new FormComponent( "com.formdev.flatlaf.testing.FlatTypographyTest$FontPreview" ) { name: "fontPreview83" - "fontType": "Body M / Title S / Label L" + "fontType": "Body M /" "fontSize": 14 "baseSize": 16 + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 7 13,alignx left,growx 0" + } ) + add( new FormComponent( "com.formdev.flatlaf.testing.FlatTypographyTest$FontPreview" ) { + name: "fontPreview96" + "fontType": "Title S / Label L" + "fontSize": 14 + "baseSize": 16 + "semibold": true }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { "value": "cell 7 13" } ) @@ -865,6 +912,7 @@ new FormModel { "fontSize": 12 "fontType": "H6" "baseSize": 12 + "semibold": true }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { "value": "cell 5 14" } ) @@ -878,9 +926,18 @@ new FormModel { } ) add( new FormComponent( "com.formdev.flatlaf.testing.FlatTypographyTest$FontPreview" ) { name: "fontPreview84" - "fontType": "Body S / Label M" + "fontType": "Body S /" "fontSize": 12 "baseSize": 16 + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 7 14,alignx left,growx 0" + } ) + add( new FormComponent( "com.formdev.flatlaf.testing.FlatTypographyTest$FontPreview" ) { + name: "fontPreview97" + "fontType": "Label M" + "fontSize": 12 + "baseSize": 16 + "semibold": true }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { "value": "cell 7 14" } ) @@ -897,6 +954,7 @@ new FormModel { "baseSize": 14 "fontType": "h300 / h200" "fontSize": 12 + "semibold": true }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { "value": "cell 9 14" } ) @@ -937,6 +995,7 @@ new FormModel { "fontSize": 11 "fontType": "Label S" "baseSize": 16 + "semibold": true }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { "value": "cell 7 15" } ) @@ -945,6 +1004,7 @@ new FormModel { "baseSize": 14 "fontSize": 11 "fontType": "h100" + "semibold": true }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { "value": "cell 9 15" } ) From d360375b4fedc50f843e9ed4edc0bc27ac7ed4a6 Mon Sep 17 00:00:00 2001 From: Karl Tauber Date: Fri, 19 Nov 2021 11:13:32 +0100 Subject: [PATCH 21/22] Typography: - use semibold for `h1`, `h2` and `h3` - added `h1.regular`, `h2.regular` and `h3.regular` --- .../com/formdev/flatlaf/FlatLaf.properties | 13 +++++++++--- .../uidefaults/FlatDarkLaf_1.8.0_202-mac.txt | 21 +++++++++++++------ .../uidefaults/FlatDarkLaf_1.8.0_202.txt | 12 ++++++++--- .../uidefaults/FlatLightLaf_1.8.0_202-mac.txt | 21 +++++++++++++------ .../uidefaults/FlatLightLaf_1.8.0_202.txt | 12 ++++++++--- .../uidefaults/FlatTestLaf_1.8.0_202.txt | 12 ++++++++--- .../flatlaf/testing/FlatTypographyTest.java | 18 ++++++++++++---- .../flatlaf/testing/FlatTypographyTest.jfd | 6 ++++++ .../flatlaf/themeeditor/FlatLafUIKeys.txt | 6 ++++++ 9 files changed, 93 insertions(+), 28 deletions(-) diff --git a/flatlaf-core/src/main/resources/com/formdev/flatlaf/FlatLaf.properties b/flatlaf-core/src/main/resources/com/formdev/flatlaf/FlatLaf.properties index 630ef17e..6e161a61 100644 --- a/flatlaf-core/src/main/resources/com/formdev/flatlaf/FlatLaf.properties +++ b/flatlaf-core/src/main/resources/com/formdev/flatlaf/FlatLaf.properties @@ -31,11 +31,15 @@ # headings h00.font = +24 h0.font = +18 -h1.font = +12 -h2.font = +6 -h3.font = +3 +h1.font = +12 $semibold.font +h2.font = +6 $semibold.font +h3.font = +3 $semibold.font h4.font = bold +h1.regular.font = +12 +h2.regular.font = +6 +h3.regular.font = +3 + # text large.font = +2 medium.font = -1 @@ -72,6 +76,9 @@ monospaced.font = Monospaced [style].h2 = font: $h2.font [style].h3 = font: $h3.font [style].h4 = font: $h4.font +[style].h1.regular = font: $h1.regular.font +[style].h2.regular = font: $h2.regular.font +[style].h3.regular = font: $h3.regular.font [style].large = font: $large.font [style].medium = font: $medium.font [style].small = font: $small.font diff --git a/flatlaf-testing/dumps/uidefaults/FlatDarkLaf_1.8.0_202-mac.txt b/flatlaf-testing/dumps/uidefaults/FlatDarkLaf_1.8.0_202-mac.txt index 196104bf..224fa680 100644 --- a/flatlaf-testing/dumps/uidefaults/FlatDarkLaf_1.8.0_202-mac.txt +++ b/flatlaf-testing/dumps/uidefaults/FlatDarkLaf_1.8.0_202-mac.txt @@ -72,20 +72,29 @@ #---- h1 ---- -- h1.font [active] Segoe UI plain 24 javax.swing.plaf.FontUIResource [UI] -+ h1.font [active] Helvetica Neue plain 25 javax.swing.plaf.FontUIResource [UI] +- h1.font [active] Segoe UI Semibold plain 24 javax.swing.plaf.FontUIResource [UI] ++ h1.font [active] HelveticaNeue-Medium plain 25 javax.swing.plaf.FontUIResource [UI] + +- h1.regular.font [active] Segoe UI plain 24 javax.swing.plaf.FontUIResource [UI] ++ h1.regular.font [active] Helvetica Neue plain 25 javax.swing.plaf.FontUIResource [UI] #---- h2 ---- -- h2.font [active] Segoe UI plain 18 javax.swing.plaf.FontUIResource [UI] -+ h2.font [active] Helvetica Neue plain 19 javax.swing.plaf.FontUIResource [UI] +- h2.font [active] Segoe UI Semibold plain 18 javax.swing.plaf.FontUIResource [UI] ++ h2.font [active] HelveticaNeue-Medium plain 19 javax.swing.plaf.FontUIResource [UI] + +- h2.regular.font [active] Segoe UI plain 18 javax.swing.plaf.FontUIResource [UI] ++ h2.regular.font [active] Helvetica Neue plain 19 javax.swing.plaf.FontUIResource [UI] #---- h3 ---- -- h3.font [active] Segoe UI plain 15 javax.swing.plaf.FontUIResource [UI] -+ h3.font [active] Helvetica Neue plain 16 javax.swing.plaf.FontUIResource [UI] +- h3.font [active] Segoe UI Semibold plain 15 javax.swing.plaf.FontUIResource [UI] ++ h3.font [active] HelveticaNeue-Medium plain 16 javax.swing.plaf.FontUIResource [UI] + +- h3.regular.font [active] Segoe UI plain 15 javax.swing.plaf.FontUIResource [UI] ++ h3.regular.font [active] Helvetica Neue plain 16 javax.swing.plaf.FontUIResource [UI] #---- h4 ---- diff --git a/flatlaf-testing/dumps/uidefaults/FlatDarkLaf_1.8.0_202.txt b/flatlaf-testing/dumps/uidefaults/FlatDarkLaf_1.8.0_202.txt index 4d706a84..8abdbd47 100644 --- a/flatlaf-testing/dumps/uidefaults/FlatDarkLaf_1.8.0_202.txt +++ b/flatlaf-testing/dumps/uidefaults/FlatDarkLaf_1.8.0_202.txt @@ -1385,8 +1385,11 @@ ViewportUI com.formdev.flatlaf.ui.FlatViewportUI [style].h00 font: $h00.font [style].h0 font: $h0.font +[style].h1.regular font: $h1.regular.font [style].h1 font: $h1.font +[style].h2.regular font: $h2.regular.font [style].h2 font: $h2.font +[style].h3.regular font: $h3.regular.font [style].h3 font: $h3.font [style].h4 font: $h4.font [style].large font: $large.font @@ -1425,17 +1428,20 @@ h00.font [active] Segoe UI plain 36 javax.swing.plaf.Fo #---- h1 ---- -h1.font [active] Segoe UI plain 24 javax.swing.plaf.FontUIResource [UI] +h1.font [active] Segoe UI Semibold plain 24 javax.swing.plaf.FontUIResource [UI] +h1.regular.font [active] Segoe UI plain 24 javax.swing.plaf.FontUIResource [UI] #---- h2 ---- -h2.font [active] Segoe UI plain 18 javax.swing.plaf.FontUIResource [UI] +h2.font [active] Segoe UI Semibold plain 18 javax.swing.plaf.FontUIResource [UI] +h2.regular.font [active] Segoe UI plain 18 javax.swing.plaf.FontUIResource [UI] #---- h3 ---- -h3.font [active] Segoe UI plain 15 javax.swing.plaf.FontUIResource [UI] +h3.font [active] Segoe UI Semibold plain 15 javax.swing.plaf.FontUIResource [UI] +h3.regular.font [active] Segoe UI plain 15 javax.swing.plaf.FontUIResource [UI] #---- h4 ---- diff --git a/flatlaf-testing/dumps/uidefaults/FlatLightLaf_1.8.0_202-mac.txt b/flatlaf-testing/dumps/uidefaults/FlatLightLaf_1.8.0_202-mac.txt index 196104bf..224fa680 100644 --- a/flatlaf-testing/dumps/uidefaults/FlatLightLaf_1.8.0_202-mac.txt +++ b/flatlaf-testing/dumps/uidefaults/FlatLightLaf_1.8.0_202-mac.txt @@ -72,20 +72,29 @@ #---- h1 ---- -- h1.font [active] Segoe UI plain 24 javax.swing.plaf.FontUIResource [UI] -+ h1.font [active] Helvetica Neue plain 25 javax.swing.plaf.FontUIResource [UI] +- h1.font [active] Segoe UI Semibold plain 24 javax.swing.plaf.FontUIResource [UI] ++ h1.font [active] HelveticaNeue-Medium plain 25 javax.swing.plaf.FontUIResource [UI] + +- h1.regular.font [active] Segoe UI plain 24 javax.swing.plaf.FontUIResource [UI] ++ h1.regular.font [active] Helvetica Neue plain 25 javax.swing.plaf.FontUIResource [UI] #---- h2 ---- -- h2.font [active] Segoe UI plain 18 javax.swing.plaf.FontUIResource [UI] -+ h2.font [active] Helvetica Neue plain 19 javax.swing.plaf.FontUIResource [UI] +- h2.font [active] Segoe UI Semibold plain 18 javax.swing.plaf.FontUIResource [UI] ++ h2.font [active] HelveticaNeue-Medium plain 19 javax.swing.plaf.FontUIResource [UI] + +- h2.regular.font [active] Segoe UI plain 18 javax.swing.plaf.FontUIResource [UI] ++ h2.regular.font [active] Helvetica Neue plain 19 javax.swing.plaf.FontUIResource [UI] #---- h3 ---- -- h3.font [active] Segoe UI plain 15 javax.swing.plaf.FontUIResource [UI] -+ h3.font [active] Helvetica Neue plain 16 javax.swing.plaf.FontUIResource [UI] +- h3.font [active] Segoe UI Semibold plain 15 javax.swing.plaf.FontUIResource [UI] ++ h3.font [active] HelveticaNeue-Medium plain 16 javax.swing.plaf.FontUIResource [UI] + +- h3.regular.font [active] Segoe UI plain 15 javax.swing.plaf.FontUIResource [UI] ++ h3.regular.font [active] Helvetica Neue plain 16 javax.swing.plaf.FontUIResource [UI] #---- h4 ---- diff --git a/flatlaf-testing/dumps/uidefaults/FlatLightLaf_1.8.0_202.txt b/flatlaf-testing/dumps/uidefaults/FlatLightLaf_1.8.0_202.txt index f6748391..d7271b5c 100644 --- a/flatlaf-testing/dumps/uidefaults/FlatLightLaf_1.8.0_202.txt +++ b/flatlaf-testing/dumps/uidefaults/FlatLightLaf_1.8.0_202.txt @@ -1390,8 +1390,11 @@ ViewportUI com.formdev.flatlaf.ui.FlatViewportUI [style].h00 font: $h00.font [style].h0 font: $h0.font +[style].h1.regular font: $h1.regular.font [style].h1 font: $h1.font +[style].h2.regular font: $h2.regular.font [style].h2 font: $h2.font +[style].h3.regular font: $h3.regular.font [style].h3 font: $h3.font [style].h4 font: $h4.font [style].large font: $large.font @@ -1430,17 +1433,20 @@ h00.font [active] Segoe UI plain 36 javax.swing.plaf.Fo #---- h1 ---- -h1.font [active] Segoe UI plain 24 javax.swing.plaf.FontUIResource [UI] +h1.font [active] Segoe UI Semibold plain 24 javax.swing.plaf.FontUIResource [UI] +h1.regular.font [active] Segoe UI plain 24 javax.swing.plaf.FontUIResource [UI] #---- h2 ---- -h2.font [active] Segoe UI plain 18 javax.swing.plaf.FontUIResource [UI] +h2.font [active] Segoe UI Semibold plain 18 javax.swing.plaf.FontUIResource [UI] +h2.regular.font [active] Segoe UI plain 18 javax.swing.plaf.FontUIResource [UI] #---- h3 ---- -h3.font [active] Segoe UI plain 15 javax.swing.plaf.FontUIResource [UI] +h3.font [active] Segoe UI Semibold plain 15 javax.swing.plaf.FontUIResource [UI] +h3.regular.font [active] Segoe UI plain 15 javax.swing.plaf.FontUIResource [UI] #---- h4 ---- diff --git a/flatlaf-testing/dumps/uidefaults/FlatTestLaf_1.8.0_202.txt b/flatlaf-testing/dumps/uidefaults/FlatTestLaf_1.8.0_202.txt index f0770dfc..a268b84e 100644 --- a/flatlaf-testing/dumps/uidefaults/FlatTestLaf_1.8.0_202.txt +++ b/flatlaf-testing/dumps/uidefaults/FlatTestLaf_1.8.0_202.txt @@ -1394,8 +1394,11 @@ ViewportUI com.formdev.flatlaf.ui.FlatViewportUI [style].h00 font: $h00.font [style].h0 font: $h0.font +[style].h1.regular font: $h1.regular.font [style].h1 font: $h1.font +[style].h2.regular font: $h2.regular.font [style].h2 font: $h2.font +[style].h3.regular font: $h3.regular.font [style].h3 font: $h3.font [style].h4 font: $h4.font [style].large font: $large.font @@ -1434,17 +1437,20 @@ h00.font [active] Segoe UI plain 36 javax.swing.plaf.Fo #---- h1 ---- -h1.font [active] Segoe UI plain 24 javax.swing.plaf.FontUIResource [UI] +h1.font [active] Segoe UI Semibold plain 24 javax.swing.plaf.FontUIResource [UI] +h1.regular.font [active] Segoe UI plain 24 javax.swing.plaf.FontUIResource [UI] #---- h2 ---- -h2.font [active] Segoe UI plain 18 javax.swing.plaf.FontUIResource [UI] +h2.font [active] Segoe UI Semibold plain 18 javax.swing.plaf.FontUIResource [UI] +h2.regular.font [active] Segoe UI plain 18 javax.swing.plaf.FontUIResource [UI] #---- h3 ---- -h3.font [active] Segoe UI plain 15 javax.swing.plaf.FontUIResource [UI] +h3.font [active] Segoe UI Semibold plain 15 javax.swing.plaf.FontUIResource [UI] +h3.regular.font [active] Segoe UI plain 15 javax.swing.plaf.FontUIResource [UI] #---- h4 ---- 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 cc8a5f42..a528cf06 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 @@ -437,6 +437,8 @@ public class FlatTypographyTest fontPreview2.setBaseSize(12); fontPreview2.setFontSize(24); fontPreview2.setFontType("H1"); + fontPreview2.setSemibold(true); + fontPreview2.setShowPlain(true); add(fontPreview2, "cell 0 6"); //---- fontPreview12 ---- @@ -510,6 +512,8 @@ public class FlatTypographyTest fontPreview3.setBaseSize(12); fontPreview3.setFontSize(18); fontPreview3.setFontType("H2"); + fontPreview3.setSemibold(true); + fontPreview3.setShowPlain(true); add(fontPreview3, "cell 0 7"); //---- fontPreview13 ---- @@ -583,6 +587,8 @@ public class FlatTypographyTest fontPreview4.setBaseSize(12); fontPreview4.setFontSize(15); fontPreview4.setFontType("H3"); + fontPreview4.setSemibold(true); + fontPreview4.setShowPlain(true); add(fontPreview4, "cell 0 8"); //---- fontPreview14 ---- @@ -1080,9 +1086,8 @@ public class FlatTypographyTest } private void updateFont() { - Font defaultFont = getBaseFont(); - previewLabel.setFont( defaultFont.deriveFont( bold ? Font.BOLD : Font.PLAIN, fontSize ) ); - preview2Label.setFont( defaultFont.deriveFont( Font.PLAIN, fontSize ) ); + previewLabel.setFont( getBaseFont().deriveFont( bold ? Font.BOLD : Font.PLAIN, fontSize ) ); + preview2Label.setFont( getDefaultFont().deriveFont( (float) fontSize ) ); } private void updateDescription() { @@ -1109,7 +1114,12 @@ public class FlatTypographyTest font = UIManager.getFont( "semibold.font" ); if( font == null ) - font = UIManager.getFont( "defaultFont" ); + font = getDefaultFont(); + return font; + } + + private Font getDefaultFont() { + Font font = UIManager.getFont( "defaultFont" ); if( font == null ) font = UIManager.getFont( "Label.font" ); return font; diff --git a/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatTypographyTest.jfd b/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatTypographyTest.jfd index b928b42c..f9780885 100644 --- a/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatTypographyTest.jfd +++ b/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatTypographyTest.jfd @@ -335,6 +335,8 @@ new FormModel { "baseSize": 12 "fontSize": 24 "fontType": "H1" + "semibold": true + "showPlain": true }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { "value": "cell 0 6" } ) @@ -430,6 +432,8 @@ new FormModel { "baseSize": 12 "fontSize": 18 "fontType": "H2" + "semibold": true + "showPlain": true }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { "value": "cell 0 7" } ) @@ -525,6 +529,8 @@ new FormModel { "baseSize": 12 "fontSize": 15 "fontType": "H3" + "semibold": true + "showPlain": true }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { "value": "cell 0 8" } ) diff --git a/flatlaf-theme-editor/src/main/resources/com/formdev/flatlaf/themeeditor/FlatLafUIKeys.txt b/flatlaf-theme-editor/src/main/resources/com/formdev/flatlaf/themeeditor/FlatLafUIKeys.txt index caa55b35..7d9af480 100644 --- a/flatlaf-theme-editor/src/main/resources/com/formdev/flatlaf/themeeditor/FlatLafUIKeys.txt +++ b/flatlaf-theme-editor/src/main/resources/com/formdev/flatlaf/themeeditor/FlatLafUIKeys.txt @@ -1067,8 +1067,11 @@ ViewportUI [style].h0 [style].h00 [style].h1 +[style].h1.regular [style].h2 +[style].h2.regular [style].h3 +[style].h3.regular [style].h4 [style].large [style].light @@ -1091,8 +1094,11 @@ desktop h0.font h00.font h1.font +h1.regular.font h2.font +h2.regular.font h3.font +h3.regular.font h4.font html.missingImage html.pendingImage From 8914cf78a103ebfb6aea9d6cdd0cd084c690b36d Mon Sep 17 00:00:00 2001 From: Karl Tauber Date: Fri, 19 Nov 2021 11:37:46 +0100 Subject: [PATCH 22/22] Typography: Theme Editor: added `h1.regular`, `h2.regular` and `h3.regular` to preview --- .../themeeditor/FlatThemePreviewFonts.java | 25 ++++++++++++++++++- .../themeeditor/FlatThemePreviewFonts.jfd | 14 ++++++++++- 2 files changed, 37 insertions(+), 2 deletions(-) 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 9a8d2510..e604c8c7 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 @@ -101,16 +101,19 @@ public class FlatThemePreviewFonts //---- h1Preview ---- h1Preview.setFontType("H1"); h1Preview.setFontStyle("h1"); + h1Preview.setFontStyleRegular("h1.regular"); add(h1Preview, "cell 0 3,gapx 12"); //---- h2Preview ---- h2Preview.setFontType("H2"); h2Preview.setFontStyle("h2"); + h2Preview.setFontStyleRegular("h2.regular"); add(h2Preview, "cell 0 4,gapx 12"); //---- h3Preview ---- h3Preview.setFontType("H3"); h3Preview.setFontStyle("h3"); + h3Preview.setFontStyleRegular("h3.regular"); add(h3Preview, "cell 0 5,gapx 12"); //---- h4Preview ---- @@ -163,7 +166,7 @@ public class FlatThemePreviewFonts add(monospacedPreview, "cell 0 15,gapx 12"); //---- scaleLabel ---- - scaleLabel.setText("Fonts are scaled by:"); + scaleLabel.setText("Fonts in preview are scaled by:"); add(scaleLabel, "cell 0 16,gapx 12"); //---- scaleValueLabel ---- @@ -185,6 +188,7 @@ public class FlatThemePreviewFonts { private String fontType; private String fontStyle; + private String fontStyleRegular; private FontPreview() { initComponents(); @@ -193,6 +197,8 @@ public class FlatThemePreviewFonts previewLabel.addPropertyChangeListener( "font", e -> { updateDescription( previewLabel.getFont() ); } ); + + preview2Label.setVisible( false ); } public String getFontType() { @@ -202,6 +208,7 @@ public class FlatThemePreviewFonts public void setFontType( String fontType ) { this.fontType = fontType; previewLabel.setText( fontType ); + preview2Label.setText( " / " + fontType ); } public String getFontStyle() { @@ -213,6 +220,16 @@ public class FlatThemePreviewFonts previewLabel.putClientProperty( FlatClientProperties.STYLE_CLASS, fontStyle ); } + public String getFontStyleRegular() { + return fontStyleRegular; + } + + public void setFontStyleRegular( String fontStyleRegular ) { + this.fontStyleRegular = fontStyleRegular; + preview2Label.putClientProperty( FlatClientProperties.STYLE_CLASS, fontStyleRegular ); + preview2Label.setVisible( fontStyleRegular != null ); + } + private void updateDescription( Font font ) { int baseSize = getDefaultFont().getSize(); int fontSize = font.getSize(); @@ -236,6 +253,7 @@ public class FlatThemePreviewFonts private void initComponents() { // JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents previewLabel = new JLabel(); + preview2Label = new JLabel(); descLabel = new JLabel(); //======== this ======== @@ -251,6 +269,10 @@ public class FlatThemePreviewFonts previewLabel.setText("preview"); add(previewLabel, "cell 0 0"); + //---- preview2Label ---- + preview2Label.setText("preview"); + add(preview2Label, "cell 0 0,gapx 0"); + //---- descLabel ---- descLabel.setText("description"); descLabel.putClientProperty("FlatLaf.styleClass", "medium"); @@ -260,6 +282,7 @@ public class FlatThemePreviewFonts // JFormDesigner - Variables declaration - DO NOT MODIFY //GEN-BEGIN:variables private JLabel previewLabel; + private JLabel preview2Label; private JLabel descLabel; // JFormDesigner - End of variables declaration //GEN-END:variables } diff --git a/flatlaf-theme-editor/src/main/java/com/formdev/flatlaf/themeeditor/FlatThemePreviewFonts.jfd b/flatlaf-theme-editor/src/main/java/com/formdev/flatlaf/themeeditor/FlatThemePreviewFonts.jfd index 002e1736..e0dfb9b3 100644 --- a/flatlaf-theme-editor/src/main/java/com/formdev/flatlaf/themeeditor/FlatThemePreviewFonts.jfd +++ b/flatlaf-theme-editor/src/main/java/com/formdev/flatlaf/themeeditor/FlatThemePreviewFonts.jfd @@ -37,6 +37,7 @@ new FormModel { name: "h1Preview" "fontType": "H1" "fontStyle": "h1" + "fontStyleRegular": "h1.regular" }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { "value": "cell 0 3,gapx 12" } ) @@ -44,6 +45,7 @@ new FormModel { name: "h2Preview" "fontType": "H2" "fontStyle": "h2" + "fontStyleRegular": "h2.regular" }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { "value": "cell 0 4,gapx 12" } ) @@ -51,6 +53,7 @@ new FormModel { name: "h3Preview" "fontType": "H3" "fontStyle": "h3" + "fontStyleRegular": "h3.regular" }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { "value": "cell 0 5,gapx 12" } ) @@ -128,7 +131,7 @@ new FormModel { } ) add( new FormComponent( "javax.swing.JLabel" ) { name: "scaleLabel" - "text": "Fonts are scaled by:" + "text": "Fonts in preview are scaled by:" }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { "value": "cell 0 16,gapx 12" } ) @@ -165,6 +168,15 @@ new FormModel { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { "value": "cell 0 0" } ) + add( new FormComponent( "javax.swing.JLabel" ) { + name: "preview2Label" + "text": "preview" + auxiliary() { + "JavaCodeGenerator.variableLocal": false + } + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 0 0,gapx 0" + } ) add( new FormComponent( "javax.swing.JLabel" ) { name: "descLabel" "text": "description"