diff --git a/CHANGELOG.md b/CHANGELOG.md index e0358cac..bbab99e2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,9 @@ FlatLaf Change Log - Style classes allow defining style rules at a single place (in UI defaults) and use them in any component. (PR #388)\ E.g.: `mySlider.putClientProperty( "FlatLaf.styleClass", "myclass" );` +- Typography defines several font styles for headers and various text sizes, + which makes it easy to use consistent font styles across the application. (PR + #396) - Native window decorations: Show Windows 11 snap layouts menu when hovering the mouse over the maximize button. (issues #397 and #407) - TextField, FormattedTextField and PasswordField: Support leading and trailing 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 54ca5c34..324c8e8f 100644 --- a/flatlaf-core/src/main/java/com/formdev/flatlaf/FlatLaf.java +++ b/flatlaf-core/src/main/java/com/formdev/flatlaf/FlatLaf.java @@ -534,7 +534,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() ) { @@ -618,7 +618,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 ); } /** @@ -1221,6 +1221,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; @@ -1230,7 +1231,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} @@ -1241,9 +1244,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; @@ -1254,16 +1258,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 cebcf2de..75000001 100644 --- a/flatlaf-core/src/main/java/com/formdev/flatlaf/UIDefaultsLoader.java +++ b/flatlaf-core/src/main/java/com/formdev/flatlaf/UIDefaultsLoader.java @@ -441,10 +441,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 { @@ -536,6 +533,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 ) { @@ -1051,7 +1054,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 ); @@ -1064,6 +1067,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 ) ); @@ -1113,6 +1117,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 ) @@ -1139,7 +1149,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; } @@ -1292,7 +1302,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() ); 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 2d78caa9..eb5c8018 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,68 @@ # Instead copy and modify only those properties that you need to alter. # +#---- typography / fonts ---- + +# headings +h00.font = +24 +h0.font = +18 +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 +small.font = -2 +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-Thin" +[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 +[linux]monospaced.font = "Liberation Mono", "Ubuntu Mono", Monospaced +monospaced.font = Monospaced + +# 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].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 +[style].mini = font: $mini.font +[style].light = font: $light.font +[style].semibold = font: $semibold.font +[style].monospaced = font: $monospaced.font + + #---- UI delegates ---- ButtonUI = com.formdev.flatlaf.ui.FlatButtonUI 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..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 @@ -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.*; /** @@ -130,6 +134,22 @@ 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 lightLabel = new JLabel(); + JLabel semiboldLabel = new JLabel(); + JLabel fontZoomLabel = 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 +180,8 @@ class BasicComponentsPanel "[]para" + "[]" + "[]" + + "[]" + + "[]0" + "[]")); //---- labelLabel ---- @@ -667,6 +689,85 @@ 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"); + + //---- lightLabel ---- + lightLabel.setText("light"); + lightLabel.putClientProperty("FlatLaf.style", "font: 200% $light.font"); + add(lightLabel, "cell 1 15 5 1,gapx 30"); + + //---- semiboldLabel ---- + semiboldLabel.setText("semibold"); + semiboldLabel.putClientProperty("FlatLaf.style", "font: 200% $semibold.font"); + add(semiboldLabel, "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"); + largeLabel.putClientProperty("FlatLaf.styleClass", "large"); + add(largeLabel, "cell 1 16 5 1"); + + //---- defaultLabel ---- + defaultLabel.setText("default"); + add(defaultLabel, "cell 1 16 5 1"); + + //---- mediumLabel ---- + mediumLabel.setText("medium"); + mediumLabel.putClientProperty("FlatLaf.styleClass", "medium"); + add(mediumLabel, "cell 1 16 5 1"); + + //---- smallLabel ---- + smallLabel.setText("small"); + smallLabel.putClientProperty("FlatLaf.styleClass", "small"); + add(smallLabel, "cell 1 16 5 1"); + + //---- miniLabel ---- + miniLabel.setText("mini"); + miniLabel.putClientProperty("FlatLaf.styleClass", "mini"); + add(miniLabel, "cell 1 16 5 1"); + + //---- monospacedLabel ---- + monospacedLabel.setText("monospaced"); + monospacedLabel.putClientProperty("FlatLaf.styleClass", "monospaced"); + add(monospacedLabel, "cell 1 16 5 1,gapx 30"); + //======== popupMenu1 ======== { @@ -705,37 +806,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 53d6e8aa..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 @@ -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" ) { @@ -671,9 +671,120 @@ 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: "lightLabel" + "text": "light" + "$client.FlatLaf.style": "font: 200% $light.font" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 1 15 5 1,gapx 30" + } ) + 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: "fontZoomLabel" + "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 16 5 1" + } ) + add( new FormComponent( "javax.swing.JLabel" ) { + name: "defaultLabel" + "text": "default" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "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 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 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 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 16 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 +804,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 ) } ) } 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 f622b28e..c37891c7 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; @@ -50,7 +51,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; @@ -160,8 +160,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 69331043..c537a20b 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 @@ -444,7 +444,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"); @@ -457,28 +457,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); @@ -486,14 +486,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); @@ -508,7 +508,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"); @@ -520,15 +520,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); @@ -538,14 +538,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"); @@ -563,7 +563,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"); @@ -575,22 +575,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); @@ -605,7 +605,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"); @@ -617,16 +617,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); @@ -664,14 +664,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"); @@ -701,14 +701,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"); @@ -759,14 +759,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"); @@ -790,7 +790,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"); @@ -808,7 +808,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"); @@ -829,14 +829,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"); @@ -901,22 +901,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); @@ -936,15 +936,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); @@ -970,15 +970,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); @@ -997,15 +997,15 @@ class TabsPanel //---- underlinedTabTypeButton ---- underlinedTabTypeButton.setText("underlined"); - underlinedTabTypeButton.setFont(underlinedTabTypeButton.getFont().deriveFont(underlinedTabTypeButton.getFont().getSize() - 2f)); underlinedTabTypeButton.setSelected(true); + underlinedTabTypeButton.putClientProperty("FlatLaf.styleClass", "small"); underlinedTabTypeButton.setName("underlinedTabTypeButton"); underlinedTabTypeButton.addActionListener(e -> tabTypeChanged()); tabTypeToolBar.add(underlinedTabTypeButton); //---- cardTabTypeButton ---- cardTabTypeButton.setText("card"); - cardTabTypeButton.setFont(cardTabTypeButton.getFont().deriveFont(cardTabTypeButton.getFont().getSize() - 2f)); + cardTabTypeButton.putClientProperty("FlatLaf.styleClass", "small"); cardTabTypeButton.setName("cardTabTypeButton"); cardTabTypeButton.addActionListener(e -> tabTypeChanged()); tabTypeToolBar.add(cardTabTypeButton); 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 2125677a..ca272a50 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 ) { @@ -550,16 +550,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 ) { @@ -577,16 +577,16 @@ new FormModel { add( new FormComponent( "javax.swing.JToggleButton" ) { name: "underlinedTabTypeButton" "text": "underlined" - "font": &SwingDerivedFont8 new com.jformdesigner.model.SwingDerivedFont( null, 0, -2, false ) "selected": true "$buttonGroup": new FormReference( "tabTypeButtonGroup" ) + "$client.FlatLaf.styleClass": "small" addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "tabTypeChanged", false ) ) } ) add( new FormComponent( "javax.swing.JToggleButton" ) { name: "cardTabTypeButton" "text": "card" - "font": #SwingDerivedFont8 "$buttonGroup": new FormReference( "tabTypeButtonGroup" ) + "$client.FlatLaf.styleClass": "small" addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "tabTypeChanged", false ) ) } ) }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { @@ -597,7 +597,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-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 ); + } } diff --git a/flatlaf-testing/dumps/uidefaults/FlatDarkLaf_1.8.0-mac.txt b/flatlaf-testing/dumps/uidefaults/FlatDarkLaf_1.8.0-mac.txt index ca6fa9ba..224fa680 100644 --- a/flatlaf-testing/dumps/uidefaults/FlatDarkLaf_1.8.0-mac.txt +++ b/flatlaf-testing/dumps/uidefaults/FlatDarkLaf_1.8.0-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,93 @@ - 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 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 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 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 ---- + +- 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] + + +#---- light ---- + +- 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 ---- + +- 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] + + +#---- 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] ++ small.font [active] Helvetica Neue plain 11 javax.swing.plaf.FontUIResource [UI] diff --git a/flatlaf-testing/dumps/uidefaults/FlatDarkLaf_1.8.0.txt b/flatlaf-testing/dumps/uidefaults/FlatDarkLaf_1.8.0.txt index 718a7c03..fdc94768 100644 --- a/flatlaf-testing/dumps/uidefaults/FlatDarkLaf_1.8.0.txt +++ b/flatlaf-testing/dumps/uidefaults/FlatDarkLaf_1.8.0.txt @@ -1386,6 +1386,26 @@ 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.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 +[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 + + #---- ---- activeCaption #434e60 HSL 217 18 32 javax.swing.plaf.ColorUIResource [UI] @@ -1401,6 +1421,39 @@ 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 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 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 Semibold plain 15 javax.swing.plaf.FontUIResource [UI] +h3.regular.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 +1475,52 @@ laf.dark true laf.scaleFactor [active] 1.0 +#---- large ---- + +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] + + #---- ---- 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] + + +#---- 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%) +#---- 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] + + #---- swingx/TaskPane ---- swingx/TaskPaneUI com.formdev.flatlaf.swingx.ui.FlatTaskPaneUI diff --git a/flatlaf-testing/dumps/uidefaults/FlatLightLaf_1.8.0-mac.txt b/flatlaf-testing/dumps/uidefaults/FlatLightLaf_1.8.0-mac.txt index ca6fa9ba..224fa680 100644 --- a/flatlaf-testing/dumps/uidefaults/FlatLightLaf_1.8.0-mac.txt +++ b/flatlaf-testing/dumps/uidefaults/FlatLightLaf_1.8.0-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,93 @@ - 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 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 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 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 ---- + +- 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] + + +#---- light ---- + +- 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 ---- + +- 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] + + +#---- 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] ++ small.font [active] Helvetica Neue plain 11 javax.swing.plaf.FontUIResource [UI] diff --git a/flatlaf-testing/dumps/uidefaults/FlatLightLaf_1.8.0.txt b/flatlaf-testing/dumps/uidefaults/FlatLightLaf_1.8.0.txt index d6055768..a1eb2677 100644 --- a/flatlaf-testing/dumps/uidefaults/FlatLightLaf_1.8.0.txt +++ b/flatlaf-testing/dumps/uidefaults/FlatLightLaf_1.8.0.txt @@ -1391,6 +1391,26 @@ 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.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 +[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 + + #---- ---- activeCaption #99b4d1 HSL 211 38 71 javax.swing.plaf.ColorUIResource [UI] @@ -1406,6 +1426,39 @@ 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 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 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 Semibold plain 15 javax.swing.plaf.FontUIResource [UI] +h3.regular.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) @@ -1427,13 +1480,52 @@ laf.dark false laf.scaleFactor [active] 1.0 +#---- large ---- + +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] + + #---- ---- 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] + + +#---- 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%) +#---- 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] + + #---- swingx/TaskPane ---- swingx/TaskPaneUI com.formdev.flatlaf.swingx.ui.FlatTaskPaneUI diff --git a/flatlaf-testing/dumps/uidefaults/FlatTestLaf_1.8.0.txt b/flatlaf-testing/dumps/uidefaults/FlatTestLaf_1.8.0.txt index 8aa2d85c..df202d17 100644 --- a/flatlaf-testing/dumps/uidefaults/FlatTestLaf_1.8.0.txt +++ b/flatlaf-testing/dumps/uidefaults/FlatTestLaf_1.8.0.txt @@ -1405,6 +1405,26 @@ 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.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 +[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 + + #---- ---- activeCaption #99b4d1 HSL 211 38 71 javax.swing.plaf.ColorUIResource [UI] @@ -1420,6 +1440,39 @@ 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 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 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 Semibold plain 15 javax.swing.plaf.FontUIResource [UI] +h3.regular.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) @@ -1441,13 +1494,52 @@ laf.dark false laf.scaleFactor [active] 1.0 +#---- large ---- + +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] + + #---- ---- 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] + + +#---- monospaced ---- + +monospaced.font [active] Consolas plain 12 javax.swing.plaf.FontUIResource [UI] + + +#---- ---- + 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] + + #---- swingx/TaskPane ---- swingx/TaskPaneUI com.formdev.flatlaf.swingx.ui.FlatTaskPaneUI 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-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 ) + } ) + } +} 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..a528cf06 --- /dev/null +++ b/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatTypographyTest.java @@ -0,0 +1,1162 @@ +/* +/* + * 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 label29 = 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 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(); + 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 fontPreview37 = 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 fontPreview38 = 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 fontPreview79 = 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 fontPreview80 = 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 fontPreview81 = 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 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(); + 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 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(); + 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 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(); + 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 ======== + setLayout(new MigLayout( + "ltr,insets dialog,hidemode 3", + // columns + "[left]unrel" + + "[left]unrel" + + "[left]unrel" + + "[left]unrel" + + "[left]unrel" + + "[left]unrel" + + "[left]unrel" + + "[fill]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"); + + //---- 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 8 0"); + + //---- label37 ---- + label37.setText("Atlassian"); + label37.putClientProperty("FlatLaf.styleClass", "h1"); + add(label37, "cell 9 0"); + + //---- label46 ---- + label46.setText("Iris"); + label46.putClientProperty("FlatLaf.styleClass", "h1"); + add(label46, "cell 10 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"); + + //---- 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 8 1"); + + //---- linkLabel6 ---- + linkLabel6.setLink("https://atlassian.design/foundations/typography"); + add(linkLabel6, "cell 9 1"); + + //---- linkLabel7 ---- + linkLabel7.setLink("https://iris.alkamitech.com/foundations/typography.html"); + add(linkLabel7, "cell 10 1"); + + //---- fontPreview69 ---- + fontPreview69.setFontType("H1"); + fontPreview69.setFontSize(96); + fontPreview69.setBaseSize(16); + fontPreview69.setLight(true); + 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("Disp"); + fontPreview40.setBaseSize(14); + fontPreview40.setSemibold(true); + 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"); + 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 ---- + 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); + fontPreview51.setSemibold(true); + add(fontPreview51, "cell 9 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 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 ---- + fontPreview71.setFontType("H3"); + fontPreview71.setFontSize(48); + 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 8 4"); + + //---- fontPreview54 ---- + fontPreview54.setBaseSize(14); + fontPreview54.setFontType("h800"); + fontPreview54.setFontSize(29); + fontPreview54.setSemibold(true); + add(fontPreview54, "cell 9 4"); + + //---- fontPreview62 ---- + fontPreview62.setBaseSize(16); + fontPreview62.setFontSize(44); + fontPreview62.setFontType("Hero"); + add(fontPreview62, "cell 10 4"); + add(separator3, "cell 0 5 11 1,growx"); + + //---- fontPreview2 ---- + fontPreview2.setBaseSize(12); + fontPreview2.setFontSize(24); + fontPreview2.setFontType("H1"); + fontPreview2.setSemibold(true); + fontPreview2.setShowPlain(true); + 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); + 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 ---- + fontPreview72.setFontType("H4"); + fontPreview72.setFontSize(34); + 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 8 6"); + + //---- fontPreview55 ---- + fontPreview55.setBaseSize(14); + fontPreview55.setFontType("h700"); + fontPreview55.setFontSize(24); + fontPreview55.setSemibold(true); + add(fontPreview55, "cell 9 6"); + + //---- fontPreview63 ---- + fontPreview63.setBaseSize(16); + fontPreview63.setFontSize(32); + fontPreview63.setFontType("H1"); + add(fontPreview63, "cell 10 6"); + + //---- fontPreview3 ---- + fontPreview3.setBaseSize(12); + fontPreview3.setFontSize(18); + fontPreview3.setFontType("H2"); + fontPreview3.setSemibold(true); + fontPreview3.setShowPlain(true); + 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); + 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 ---- + fontPreview73.setFontType("H5"); + fontPreview73.setFontSize(24); + 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 8 7"); + + //---- fontPreview57 ---- + fontPreview57.setBaseSize(14); + fontPreview57.setFontType("h600"); + fontPreview57.setFontSize(20); + fontPreview57.setSemibold(true); + add(fontPreview57, "cell 9 7"); + + //---- fontPreview64 ---- + fontPreview64.setBaseSize(16); + fontPreview64.setFontType("H2"); + fontPreview64.setFontSize(24); + add(fontPreview64, "cell 10 7"); + + //---- fontPreview4 ---- + fontPreview4.setBaseSize(12); + fontPreview4.setFontSize(15); + fontPreview4.setFontType("H3"); + fontPreview4.setSemibold(true); + fontPreview4.setShowPlain(true); + 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); + 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 ---- + 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 8 8"); + + //---- fontPreview58 ---- + fontPreview58.setBaseSize(14); + fontPreview58.setFontType("h500"); + fontPreview58.setFontSize(16); + fontPreview58.setSemibold(true); + add(fontPreview58, "cell 9 8"); + + //---- fontPreview65 ---- + fontPreview65.setBaseSize(16); + fontPreview65.setFontSize(20); + fontPreview65.setFontType("H3"); + add(fontPreview65, "cell 10 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"); + + //---- fontPreview81 ---- + fontPreview81.setFontType("Title L"); + fontPreview81.setFontSize(22); + fontPreview81.setBaseSize(16); + fontPreview81.setSemibold(true); + add(fontPreview81, "cell 7 9"); + + //---- fontPreview56 ---- + fontPreview56.setFontType("Large Text / Header 5"); + fontPreview56.setFontSize(16); + fontPreview56.setBaseSize(14); + add(fontPreview56, "cell 8 9"); + + //---- fontPreview66 ---- + fontPreview66.setBaseSize(16); + fontPreview66.setFontType("H4"); + fontPreview66.setFontSize(18); + add(fontPreview66, "cell 10 9"); + add(separator1, "cell 0 10 11 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 /"); + fontPreview90.setBaseSize(16); + 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); + fontPreview75.setFontType("Body 1 / Subtitle 1"); + fontPreview75.setBaseSize(16); + add(fontPreview75, "cell 6 11"); + + //---- fontPreview82 ---- + fontPreview82.setFontSize(16); + fontPreview82.setFontType("Body L /"); + fontPreview82.setBaseSize(16); + 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"); + fontPreview52.setFontSize(14); + fontPreview52.setBaseSize(14); + add(fontPreview52, "cell 8 11"); + + //---- fontPreview59 ---- + fontPreview59.setBaseSize(14); + fontPreview59.setFontSize(14); + fontPreview59.setFontType("h400"); + fontPreview59.setSemibold(true); + add(fontPreview59, "cell 9 11"); + + //---- fontPreview67 ---- + fontPreview67.setBaseSize(16); + fontPreview67.setFontSize(16); + fontPreview67.setFontType("Body"); + add(fontPreview67, "cell 10 11"); + add(separator2, "cell 0 12 11 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); + fontPreview91.setSemibold(true); + add(fontPreview91, "cell 5 13"); + + //---- fontPreview76 ---- + fontPreview76.setFontType("Body 2 / Subtitle 2"); + fontPreview76.setFontSize(14); + fontPreview76.setBaseSize(16); + add(fontPreview76, "cell 6 13"); + + //---- fontPreview83 ---- + fontPreview83.setFontType("Body M /"); + fontPreview83.setFontSize(14); + fontPreview83.setBaseSize(16); + 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"); + 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); + fontPreview92.setSemibold(true); + add(fontPreview92, "cell 5 14"); + + //---- fontPreview77 ---- + fontPreview77.setFontSize(12); + fontPreview77.setFontType("Caption"); + fontPreview77.setBaseSize(16); + add(fontPreview77, "cell 6 14"); + + //---- fontPreview84 ---- + fontPreview84.setFontType("Body S /"); + fontPreview84.setFontSize(12); + fontPreview84.setBaseSize(16); + 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"); + fontPreview53.setFontSize(12); + fontPreview53.setBaseSize(14); + add(fontPreview53, "cell 8 14"); + + //---- fontPreview60 ---- + fontPreview60.setBaseSize(14); + fontPreview60.setFontType("h300 / h200"); + fontPreview60.setFontSize(12); + fontPreview60.setSemibold(true); + add(fontPreview60, "cell 9 14"); + + //---- fontPreview68 ---- + fontPreview68.setBaseSize(16); + fontPreview68.setFontType("Small"); + fontPreview68.setFontSize(14); + add(fontPreview68, "cell 10 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"); + + //---- fontPreview94 ---- + 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 + } + + // 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 light; + private boolean semibold; + 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 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; + } + + 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() { + previewLabel.setFont( getBaseFont().deriveFont( bold ? Font.BOLD : Font.PLAIN, fontSize ) ); + preview2Label.setFont( getDefaultFont().deriveFont( (float) 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( light ) + buf.append( " light" ); + if( semibold ) + buf.append( " semibold" ); + if( bold ) + buf.append( " bold" ); + descLabel.setText( buf.toString() ); + } + + 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 = getDefaultFont(); + return font; + } + + 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..f9780885 --- /dev/null +++ b/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatTypographyTest.jfd @@ -0,0 +1,1064 @@ +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[fill]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: "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 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 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 10 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: "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 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 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 10 1" + } ) + add( new FormComponent( "com.formdev.flatlaf.testing.FlatTypographyTest$FontPreview" ) { + name: "fontPreview69" + "fontType": "H1" + "fontSize": 96 + "baseSize": 16 + "light": true + }, 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": "Disp" + "baseSize": 14 + "semibold": true + }, 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 + "fontType": "H00" + "baseSize": 16 + "semibold": true + }, 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 + "light": true + }, 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 + "semibold": true + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 9 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 L" + "fontSize": 40 + "baseSize": 14 + "semibold": true + }, 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 + "semibold": true + }, 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: "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 8 4" + } ) + add( new FormComponent( "com.formdev.flatlaf.testing.FlatTypographyTest$FontPreview" ) { + name: "fontPreview54" + "baseSize": 14 + "fontType": "h800" + "fontSize": 29 + "semibold": true + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 9 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 10 4" + } ) + add( new FormComponent( "javax.swing.JSeparator" ) { + name: "separator3" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 0 5 11 1,growx" + } ) + add( new FormComponent( "com.formdev.flatlaf.testing.FlatTypographyTest$FontPreview" ) { + name: "fontPreview2" + "baseSize": 12 + "fontSize": 24 + "fontType": "H1" + "semibold": true + "showPlain": true + }, 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 + "semibold": true + }, 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 + "semibold": true + }, 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: "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 8 6" + } ) + add( new FormComponent( "com.formdev.flatlaf.testing.FlatTypographyTest$FontPreview" ) { + name: "fontPreview55" + "baseSize": 14 + "fontType": "h700" + "fontSize": 24 + "semibold": true + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 9 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 10 6" + } ) + add( new FormComponent( "com.formdev.flatlaf.testing.FlatTypographyTest$FontPreview" ) { + name: "fontPreview3" + "baseSize": 12 + "fontSize": 18 + "fontType": "H2" + "semibold": true + "showPlain": true + }, 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 + "semibold": true + }, 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 + "semibold": true + }, 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: "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 8 7" + } ) + add( new FormComponent( "com.formdev.flatlaf.testing.FlatTypographyTest$FontPreview" ) { + name: "fontPreview57" + "baseSize": 14 + "fontType": "h600" + "fontSize": 20 + "semibold": true + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 9 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 10 7" + } ) + add( new FormComponent( "com.formdev.flatlaf.testing.FlatTypographyTest$FontPreview" ) { + name: "fontPreview4" + "baseSize": 12 + "fontSize": 15 + "fontType": "H3" + "semibold": true + "showPlain": true + }, 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 + "semibold": true + }, 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 + "semibold": true + }, 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 8 8" + } ) + add( new FormComponent( "com.formdev.flatlaf.testing.FlatTypographyTest$FontPreview" ) { + name: "fontPreview58" + "baseSize": 14 + "fontType": "h500" + "fontSize": 16 + "semibold": true + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 9 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 10 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: "fontPreview81" + "fontType": "Title L" + "fontSize": 22 + "baseSize": 16 + "semibold": true + }, 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 8 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 10 9" + } ) + add( new FormComponent( "javax.swing.JSeparator" ) { + name: "separator1" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 0 10 11 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 /" + "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" + } ) + 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: "fontPreview82" + "fontSize": 16 + "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" + } ) + 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 8 11" + } ) + add( new FormComponent( "com.formdev.flatlaf.testing.FlatTypographyTest$FontPreview" ) { + name: "fontPreview59" + "baseSize": 14 + "fontSize": 14 + "fontType": "h400" + "semibold": true + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 9 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 10 11" + } ) + add( new FormComponent( "javax.swing.JSeparator" ) { + name: "separator2" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 0 12 11 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 + "semibold": true + }, 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: "fontPreview83" + "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" + } ) + 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 + "semibold": true + }, 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: "fontPreview84" + "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" + } ) + 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 8 14" + } ) + add( new FormComponent( "com.formdev.flatlaf.testing.FlatTypographyTest$FontPreview" ) { + name: "fontPreview60" + "baseSize": 14 + "fontType": "h300 / h200" + "fontSize": 12 + "semibold": true + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 9 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 10 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: "fontPreview94" + "fontSize": 11 + "fontType": "Label S" + "baseSize": 16 + "semibold": true + }, 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" + "semibold": true + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 9 15" + } ) + }, new FormLayoutConstraints( null ) { + "location": new java.awt.Point( 5, 0 ) + "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" + "$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 ) + } ) + } +} 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 4290baa2..87d5a289 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; @@ -754,8 +754,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 22125a94..0c2f0026 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( this ); + 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() ); @@ -175,7 +178,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 -> { @@ -189,6 +193,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 @@ -196,7 +206,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; @@ -215,6 +225,7 @@ class FlatThemePreview { tabbedPane.setLeadingComponent(previewLabel); tabbedPane.setTabAreaAlignment(FlatTabbedPane.TabAreaAlignment.trailing); + tabbedPane.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT); } add(tabbedPane, BorderLayout.CENTER); @@ -223,8 +234,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..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" } ) @@ -24,8 +25,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/FlatThemePreviewFonts.java b/flatlaf-theme-editor/src/main/java/com/formdev/flatlaf/themeeditor/FlatThemePreviewFonts.java new file mode 100644 index 00000000..e604c8c7 --- /dev/null +++ b/flatlaf-theme-editor/src/main/java/com/formdev/flatlaf/themeeditor/FlatThemePreviewFonts.java @@ -0,0 +1,289 @@ +/* +/* + * 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 lightPreview = new FlatThemePreviewFonts.FontPreview(); + FlatThemePreviewFonts.FontPreview semiboldPreview = 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" + + "[]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"); + 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 ---- + 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"); + + //---- 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 15,gapx 12"); + + //---- scaleLabel ---- + scaleLabel.setText("Fonts in preview are scaled by:"); + add(scaleLabel, "cell 0 16,gapx 12"); + + //---- scaleValueLabel ---- + scaleValueLabel.setText("1x"); + scaleValueLabel.putClientProperty("FlatLaf.styleClass", "h2"); + add(scaleValueLabel, "cell 0 16"); + // 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 String fontStyleRegular; + + private FontPreview() { + initComponents(); + + updateDescription( previewLabel.getFont() ); + previewLabel.addPropertyChangeListener( "font", e -> { + updateDescription( previewLabel.getFont() ); + } ); + + preview2Label.setVisible( false ); + } + + public String getFontType() { + return fontType; + } + + public void setFontType( String fontType ) { + this.fontType = fontType; + previewLabel.setText( fontType ); + preview2Label.setText( " / " + fontType ); + } + + public String getFontStyle() { + return fontStyle; + } + + public void setFontStyle( String fontStyle ) { + this.fontStyle = fontStyle; + 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(); + + 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(); + preview2Label = 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"); + + //---- preview2Label ---- + preview2Label.setText("preview"); + add(preview2Label, "cell 0 0,gapx 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 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 new file mode 100644 index 00000000..e0dfb9b3 --- /dev/null +++ b/flatlaf-theme-editor/src/main/java/com/formdev/flatlaf/themeeditor/FlatThemePreviewFonts.jfd @@ -0,0 +1,195 @@ +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[]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" + "fontStyleRegular": "h1.regular" + }, 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" + "fontStyleRegular": "h2.regular" + }, 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" + "fontStyleRegular": "h3.regular" + }, 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: "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 15,gapx 12" + } ) + add( new FormComponent( "javax.swing.JLabel" ) { + name: "scaleLabel" + "text": "Fonts in preview are scaled by:" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 0 16,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 16" + } ) + }, new FormLayoutConstraints( null ) { + "location": new java.awt.Point( 5, 0 ) + "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" + "$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: "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" + "$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, 545 ) + "size": new java.awt.Dimension( 235, 65 ) + } ) + } +} 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 2c6e7972..7db3daeb 100644 --- a/flatlaf-theme-editor/src/main/java/com/formdev/flatlaf/themeeditor/FlatThemePreviewSwitches.java +++ b/flatlaf-theme-editor/src/main/java/com/formdev/flatlaf/themeeditor/FlatThemePreviewSwitches.java @@ -262,25 +262,25 @@ class FlatThemePreviewSwitches //---- zoom1xButton ---- zoom1xButton.setText("1x"); zoom1xButton.setSelected(true); - zoom1xButton.setFont(zoom1xButton.getFont().deriveFont(zoom1xButton.getFont().getSize() - 2f)); + zoom1xButton.putClientProperty("FlatLaf.styleClass", "small"); zoom1xButton.addActionListener(e -> zoomChanged()); zoomToolBar.add(zoom1xButton); //---- zoom2xButton ---- zoom2xButton.setText("2x"); - zoom2xButton.setFont(zoom2xButton.getFont().deriveFont(zoom2xButton.getFont().getSize() - 2f)); + zoom2xButton.putClientProperty("FlatLaf.styleClass", "small"); zoom2xButton.addActionListener(e -> zoomChanged()); zoomToolBar.add(zoom2xButton); //---- zoom3xButton ---- zoom3xButton.setText("3x"); - zoom3xButton.setFont(zoom3xButton.getFont().deriveFont(zoom3xButton.getFont().getSize() - 2f)); + zoom3xButton.putClientProperty("FlatLaf.styleClass", "small"); zoom3xButton.addActionListener(e -> zoomChanged()); zoomToolBar.add(zoom3xButton); //---- zoom4xButton ---- zoom4xButton.setText("4x"); - zoom4xButton.setFont(zoom4xButton.getFont().deriveFont(zoom4xButton.getFont().getSize() - 2f)); + zoom4xButton.putClientProperty("FlatLaf.styleClass", "small"); zoom4xButton.addActionListener(e -> zoomChanged()); zoomToolBar.add(zoom4xButton); zoomToolBar.addSeparator(); @@ -288,6 +288,7 @@ class FlatThemePreviewSwitches //---- indeterminateButton ---- indeterminateButton.setText("indeterminate"); indeterminateButton.setSelected(true); + indeterminateButton.putClientProperty("FlatLaf.styleClass", "small"); indeterminateButton.addActionListener(e -> indeterminateChanged()); zoomToolBar.add(indeterminateButton); } @@ -297,7 +298,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 1 3 1"); //---- label1 ---- @@ -310,32 +311,32 @@ class FlatThemePreviewSwitches //---- label23 ---- label23.setText("unsel."); - label23.setFont(label23.getFont().deriveFont(label23.getFont().getSize() - 2f)); + label23.putClientProperty("FlatLaf.styleClass", "small"); add(label23, "cell 1 3,alignx center,growx 0"); //---- label28 ---- label28.setText("sel."); - label28.setFont(label28.getFont().deriveFont(label28.getFont().getSize() - 2f)); + label28.putClientProperty("FlatLaf.styleClass", "small"); add(label28, "cell 2 3,alignx center,growx 0"); //---- label37 ---- label37.setText("ind."); - label37.setFont(label37.getFont().deriveFont(label37.getFont().getSize() - 2f)); + label37.putClientProperty("FlatLaf.styleClass", "small"); add(label37, "cell 3 3,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 4 3,alignx center,growx 0"); //---- label29 ---- label29.setText("sel."); - label29.setFont(label29.getFont().deriveFont(label29.getFont().getSize() - 2f)); + label29.putClientProperty("FlatLaf.styleClass", "small"); add(label29, "cell 5 3,alignx center,growx 0"); //---- label38 ---- label38.setText("ind."); - label38.setFont(label38.getFont().deriveFont(label38.getFont().getSize() - 2f)); + label38.putClientProperty("FlatLaf.styleClass", "small"); add(label38, "cell 6 3,alignx center,growx 0"); //---- label17 ---- @@ -465,7 +466,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 9 3 1"); //---- label3 ---- @@ -478,22 +479,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 11,alignx center,growx 0"); //---- label30 ---- label30.setText("sel."); - label30.setFont(label30.getFont().deriveFont(label30.getFont().getSize() - 2f)); + label30.putClientProperty("FlatLaf.styleClass", "small"); add(label30, "cell 2 11,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 4 11,alignx center,growx 0"); //---- label31 ---- label31.setText("sel."); - label31.setFont(label31.getFont().deriveFont(label31.getFont().getSize() - 2f)); + label31.putClientProperty("FlatLaf.styleClass", "small"); add(label31, "cell 5 11,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 aebbbafe..ca8021db 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 @@ -1,4 +1,4 @@ -JFDML JFormDesigner: "7.0.4.0.360" Java: "17" encoding: "UTF-8" +JFDML JFormDesigner: "7.0.5.0.382" Java: "16" encoding: "UTF-8" new FormModel { contentType: "form/swing" @@ -32,7 +32,7 @@ new FormModel { name: "zoom1xButton" "text": "1x" "selected": true - "font": &SwingDerivedFont0 new com.jformdesigner.model.SwingDerivedFont( null, 0, -2, false ) + "$client.FlatLaf.styleClass": "small" "$buttonGroup": new FormReference( "buttonGroup1" ) auxiliary() { "JavaCodeGenerator.variableLocal": false @@ -42,7 +42,7 @@ new FormModel { add( new FormComponent( "javax.swing.JToggleButton" ) { name: "zoom2xButton" "text": "2x" - "font": #SwingDerivedFont0 + "$client.FlatLaf.styleClass": "small" "$buttonGroup": &FormReference0 new FormReference( "buttonGroup1" ) auxiliary() { "JavaCodeGenerator.variableLocal": false @@ -52,7 +52,7 @@ new FormModel { add( new FormComponent( "javax.swing.JToggleButton" ) { name: "zoom3xButton" "text": "3x" - "font": #SwingDerivedFont0 + "$client.FlatLaf.styleClass": "small" "$buttonGroup": #FormReference0 auxiliary() { "JavaCodeGenerator.variableLocal": false @@ -62,7 +62,7 @@ new FormModel { add( new FormComponent( "javax.swing.JToggleButton" ) { name: "zoom4xButton" "text": "4x" - "font": #SwingDerivedFont0 + "$client.FlatLaf.styleClass": "small" "$buttonGroup": #FormReference0 auxiliary() { "JavaCodeGenerator.variableLocal": false @@ -76,6 +76,7 @@ new FormModel { name: "indeterminateButton" "text": "indeterminate" "selected": true + "$client.FlatLaf.styleClass": "small" auxiliary() { "JavaCodeGenerator.variableLocal": false } @@ -90,7 +91,7 @@ new FormModel { add( new FormComponent( "javax.swing.JLabel" ) { name: "label22" "text": "JCheckBox" - "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" } ) @@ -109,42 +110,42 @@ new FormModel { add( new FormComponent( "javax.swing.JLabel" ) { name: "label23" "text": "unsel." - "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: "label28" "text": "sel." - "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: "label37" "text": "ind." - "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: "label24" "text": "unsel." - "font": #SwingDerivedFont2 + "$client.FlatLaf.styleClass": "small" }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { "value": "cell 4 3,alignx center,growx 0" } ) add( new FormComponent( "javax.swing.JLabel" ) { name: "label29" "text": "sel." - "font": #SwingDerivedFont2 + "$client.FlatLaf.styleClass": "small" }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { "value": "cell 5 3,alignx center,growx 0" } ) add( new FormComponent( "javax.swing.JLabel" ) { name: "label38" "text": "ind." - "font": #SwingDerivedFont2 + "$client.FlatLaf.styleClass": "small" }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { "value": "cell 6 3,alignx center,growx 0" } ) @@ -340,7 +341,7 @@ new FormModel { add( new FormComponent( "javax.swing.JLabel" ) { name: "label27" "text": "JRadioButton" - "font": #SwingDerivedFont1 + "$client.FlatLaf.styleClass": "h3" }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { "value": "cell 0 9 3 1" } ) @@ -359,28 +360,28 @@ new FormModel { add( new FormComponent( "javax.swing.JLabel" ) { name: "label25" "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: "label30" "text": "sel." - "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: "label26" "text": "unsel." - "font": #SwingDerivedFont2 + "$client.FlatLaf.styleClass": "small" }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { "value": "cell 4 11,alignx center,growx 0" } ) add( new FormComponent( "javax.swing.JLabel" ) { name: "label31" "text": "sel." - "font": #SwingDerivedFont2 + "$client.FlatLaf.styleClass": "small" }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { "value": "cell 5 11,alignx center,growx 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 5e0e90d9..a0d743ca 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 @@ -1093,6 +1093,22 @@ Viewport.background Viewport.font Viewport.foreground 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 +[style].medium +[style].mini +[style].monospaced +[style].semibold +[style].small activeCaption activeCaptionBorder activeCaptionText @@ -1104,6 +1120,15 @@ controlShadow controlText defaultFont 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 inactiveCaption @@ -1113,9 +1138,16 @@ info 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 textHighlight