mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2026-02-11 06:27:13 -06:00
Typography: Theme Editor: added h1.regular, h2.regular and h3.regular to preview
This commit is contained in:
@@ -101,16 +101,19 @@ public class FlatThemePreviewFonts
|
|||||||
//---- h1Preview ----
|
//---- h1Preview ----
|
||||||
h1Preview.setFontType("H1");
|
h1Preview.setFontType("H1");
|
||||||
h1Preview.setFontStyle("h1");
|
h1Preview.setFontStyle("h1");
|
||||||
|
h1Preview.setFontStyleRegular("h1.regular");
|
||||||
add(h1Preview, "cell 0 3,gapx 12");
|
add(h1Preview, "cell 0 3,gapx 12");
|
||||||
|
|
||||||
//---- h2Preview ----
|
//---- h2Preview ----
|
||||||
h2Preview.setFontType("H2");
|
h2Preview.setFontType("H2");
|
||||||
h2Preview.setFontStyle("h2");
|
h2Preview.setFontStyle("h2");
|
||||||
|
h2Preview.setFontStyleRegular("h2.regular");
|
||||||
add(h2Preview, "cell 0 4,gapx 12");
|
add(h2Preview, "cell 0 4,gapx 12");
|
||||||
|
|
||||||
//---- h3Preview ----
|
//---- h3Preview ----
|
||||||
h3Preview.setFontType("H3");
|
h3Preview.setFontType("H3");
|
||||||
h3Preview.setFontStyle("h3");
|
h3Preview.setFontStyle("h3");
|
||||||
|
h3Preview.setFontStyleRegular("h3.regular");
|
||||||
add(h3Preview, "cell 0 5,gapx 12");
|
add(h3Preview, "cell 0 5,gapx 12");
|
||||||
|
|
||||||
//---- h4Preview ----
|
//---- h4Preview ----
|
||||||
@@ -163,7 +166,7 @@ public class FlatThemePreviewFonts
|
|||||||
add(monospacedPreview, "cell 0 15,gapx 12");
|
add(monospacedPreview, "cell 0 15,gapx 12");
|
||||||
|
|
||||||
//---- scaleLabel ----
|
//---- scaleLabel ----
|
||||||
scaleLabel.setText("Fonts are scaled by:");
|
scaleLabel.setText("Fonts in preview are scaled by:");
|
||||||
add(scaleLabel, "cell 0 16,gapx 12");
|
add(scaleLabel, "cell 0 16,gapx 12");
|
||||||
|
|
||||||
//---- scaleValueLabel ----
|
//---- scaleValueLabel ----
|
||||||
@@ -185,6 +188,7 @@ public class FlatThemePreviewFonts
|
|||||||
{
|
{
|
||||||
private String fontType;
|
private String fontType;
|
||||||
private String fontStyle;
|
private String fontStyle;
|
||||||
|
private String fontStyleRegular;
|
||||||
|
|
||||||
private FontPreview() {
|
private FontPreview() {
|
||||||
initComponents();
|
initComponents();
|
||||||
@@ -193,6 +197,8 @@ public class FlatThemePreviewFonts
|
|||||||
previewLabel.addPropertyChangeListener( "font", e -> {
|
previewLabel.addPropertyChangeListener( "font", e -> {
|
||||||
updateDescription( previewLabel.getFont() );
|
updateDescription( previewLabel.getFont() );
|
||||||
} );
|
} );
|
||||||
|
|
||||||
|
preview2Label.setVisible( false );
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getFontType() {
|
public String getFontType() {
|
||||||
@@ -202,6 +208,7 @@ public class FlatThemePreviewFonts
|
|||||||
public void setFontType( String fontType ) {
|
public void setFontType( String fontType ) {
|
||||||
this.fontType = fontType;
|
this.fontType = fontType;
|
||||||
previewLabel.setText( fontType );
|
previewLabel.setText( fontType );
|
||||||
|
preview2Label.setText( " / " + fontType );
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getFontStyle() {
|
public String getFontStyle() {
|
||||||
@@ -213,6 +220,16 @@ public class FlatThemePreviewFonts
|
|||||||
previewLabel.putClientProperty( FlatClientProperties.STYLE_CLASS, 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 ) {
|
private void updateDescription( Font font ) {
|
||||||
int baseSize = getDefaultFont().getSize();
|
int baseSize = getDefaultFont().getSize();
|
||||||
int fontSize = font.getSize();
|
int fontSize = font.getSize();
|
||||||
@@ -236,6 +253,7 @@ public class FlatThemePreviewFonts
|
|||||||
private void initComponents() {
|
private void initComponents() {
|
||||||
// JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents
|
// JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents
|
||||||
previewLabel = new JLabel();
|
previewLabel = new JLabel();
|
||||||
|
preview2Label = new JLabel();
|
||||||
descLabel = new JLabel();
|
descLabel = new JLabel();
|
||||||
|
|
||||||
//======== this ========
|
//======== this ========
|
||||||
@@ -251,6 +269,10 @@ public class FlatThemePreviewFonts
|
|||||||
previewLabel.setText("preview");
|
previewLabel.setText("preview");
|
||||||
add(previewLabel, "cell 0 0");
|
add(previewLabel, "cell 0 0");
|
||||||
|
|
||||||
|
//---- preview2Label ----
|
||||||
|
preview2Label.setText("preview");
|
||||||
|
add(preview2Label, "cell 0 0,gapx 0");
|
||||||
|
|
||||||
//---- descLabel ----
|
//---- descLabel ----
|
||||||
descLabel.setText("description");
|
descLabel.setText("description");
|
||||||
descLabel.putClientProperty("FlatLaf.styleClass", "medium");
|
descLabel.putClientProperty("FlatLaf.styleClass", "medium");
|
||||||
@@ -260,6 +282,7 @@ public class FlatThemePreviewFonts
|
|||||||
|
|
||||||
// JFormDesigner - Variables declaration - DO NOT MODIFY //GEN-BEGIN:variables
|
// JFormDesigner - Variables declaration - DO NOT MODIFY //GEN-BEGIN:variables
|
||||||
private JLabel previewLabel;
|
private JLabel previewLabel;
|
||||||
|
private JLabel preview2Label;
|
||||||
private JLabel descLabel;
|
private JLabel descLabel;
|
||||||
// JFormDesigner - End of variables declaration //GEN-END:variables
|
// JFormDesigner - End of variables declaration //GEN-END:variables
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,6 +37,7 @@ new FormModel {
|
|||||||
name: "h1Preview"
|
name: "h1Preview"
|
||||||
"fontType": "H1"
|
"fontType": "H1"
|
||||||
"fontStyle": "h1"
|
"fontStyle": "h1"
|
||||||
|
"fontStyleRegular": "h1.regular"
|
||||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||||
"value": "cell 0 3,gapx 12"
|
"value": "cell 0 3,gapx 12"
|
||||||
} )
|
} )
|
||||||
@@ -44,6 +45,7 @@ new FormModel {
|
|||||||
name: "h2Preview"
|
name: "h2Preview"
|
||||||
"fontType": "H2"
|
"fontType": "H2"
|
||||||
"fontStyle": "h2"
|
"fontStyle": "h2"
|
||||||
|
"fontStyleRegular": "h2.regular"
|
||||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||||
"value": "cell 0 4,gapx 12"
|
"value": "cell 0 4,gapx 12"
|
||||||
} )
|
} )
|
||||||
@@ -51,6 +53,7 @@ new FormModel {
|
|||||||
name: "h3Preview"
|
name: "h3Preview"
|
||||||
"fontType": "H3"
|
"fontType": "H3"
|
||||||
"fontStyle": "h3"
|
"fontStyle": "h3"
|
||||||
|
"fontStyleRegular": "h3.regular"
|
||||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||||
"value": "cell 0 5,gapx 12"
|
"value": "cell 0 5,gapx 12"
|
||||||
} )
|
} )
|
||||||
@@ -128,7 +131,7 @@ new FormModel {
|
|||||||
} )
|
} )
|
||||||
add( new FormComponent( "javax.swing.JLabel" ) {
|
add( new FormComponent( "javax.swing.JLabel" ) {
|
||||||
name: "scaleLabel"
|
name: "scaleLabel"
|
||||||
"text": "Fonts are scaled by:"
|
"text": "Fonts in preview are scaled by:"
|
||||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||||
"value": "cell 0 16,gapx 12"
|
"value": "cell 0 16,gapx 12"
|
||||||
} )
|
} )
|
||||||
@@ -165,6 +168,15 @@ new FormModel {
|
|||||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||||
"value": "cell 0 0"
|
"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" ) {
|
add( new FormComponent( "javax.swing.JLabel" ) {
|
||||||
name: "descLabel"
|
name: "descLabel"
|
||||||
"text": "description"
|
"text": "description"
|
||||||
|
|||||||
Reference in New Issue
Block a user