Typography: added thin/light/semibold fonts to demo

This commit is contained in:
Karl Tauber
2021-11-04 12:48:46 +01:00
parent 78e37f7ab4
commit 1be84de26b
2 changed files with 68 additions and 13 deletions

View File

@@ -137,6 +137,10 @@ class BasicComponentsPanel
JLabel h2Label = new JLabel(); JLabel h2Label = new JLabel();
JLabel h3Label = new JLabel(); JLabel h3Label = new JLabel();
JLabel h4Label = new JLabel(); JLabel h4Label = new JLabel();
JLabel thinLabel = new JLabel();
JLabel lightLabel = new JLabel();
JLabel semiboldLabel = new JLabel();
JLabel label3 = new JLabel();
JLabel largeLabel = new JLabel(); JLabel largeLabel = new JLabel();
JLabel defaultLabel = new JLabel(); JLabel defaultLabel = new JLabel();
JLabel mediumLabel = new JLabel(); JLabel mediumLabel = new JLabel();
@@ -174,6 +178,7 @@ class BasicComponentsPanel
"[]" + "[]" +
"[]" + "[]" +
"[]" + "[]" +
"[]0" +
"[]")); "[]"));
//---- labelLabel ---- //---- labelLabel ----
@@ -715,34 +720,55 @@ class BasicComponentsPanel
h4Label.putClientProperty("FlatLaf.styleClass", "h4"); h4Label.putClientProperty("FlatLaf.styleClass", "h4");
add(h4Label, "cell 1 15 5 1"); add(h4Label, "cell 1 15 5 1");
//---- thinLabel ----
thinLabel.setText("thin");
thinLabel.putClientProperty("FlatLaf.style", "font: 200% $thin.font");
add(thinLabel, "cell 1 15 5 1,gapx 30");
//---- lightLabel ----
lightLabel.setText("light");
lightLabel.putClientProperty("FlatLaf.style", "font: 200% $light.font");
add(lightLabel, "cell 1 15 5 1");
//---- semiboldLabel ----
semiboldLabel.setText("semibold");
semiboldLabel.putClientProperty("FlatLaf.style", "font: 200% $semibold.font");
add(semiboldLabel, "cell 1 15 5 1");
//---- label3 ----
label3.setText("(200%)");
label3.putClientProperty("FlatLaf.styleClass", "small");
label3.setEnabled(false);
add(label3, "cell 1 15 5 1");
//---- largeLabel ---- //---- largeLabel ----
largeLabel.setText("large"); largeLabel.setText("large");
largeLabel.putClientProperty("FlatLaf.styleClass", "large"); largeLabel.putClientProperty("FlatLaf.styleClass", "large");
add(largeLabel, "cell 1 15 5 1,gapx 30"); add(largeLabel, "cell 1 16 5 1");
//---- defaultLabel ---- //---- defaultLabel ----
defaultLabel.setText("default/regular"); defaultLabel.setText("default/regular");
add(defaultLabel, "cell 1 15 5 1"); add(defaultLabel, "cell 1 16 5 1");
//---- mediumLabel ---- //---- mediumLabel ----
mediumLabel.setText("medium"); mediumLabel.setText("medium");
mediumLabel.putClientProperty("FlatLaf.styleClass", "medium"); mediumLabel.putClientProperty("FlatLaf.styleClass", "medium");
add(mediumLabel, "cell 1 15 5 1"); add(mediumLabel, "cell 1 16 5 1");
//---- smallLabel ---- //---- smallLabel ----
smallLabel.setText("small"); smallLabel.setText("small");
smallLabel.putClientProperty("FlatLaf.styleClass", "small"); smallLabel.putClientProperty("FlatLaf.styleClass", "small");
add(smallLabel, "cell 1 15 5 1"); add(smallLabel, "cell 1 16 5 1");
//---- miniLabel ---- //---- miniLabel ----
miniLabel.setText("mini"); miniLabel.setText("mini");
miniLabel.putClientProperty("FlatLaf.styleClass", "mini"); miniLabel.putClientProperty("FlatLaf.styleClass", "mini");
add(miniLabel, "cell 1 15 5 1"); add(miniLabel, "cell 1 16 5 1");
//---- monospacedLabel ---- //---- monospacedLabel ----
monospacedLabel.setText("monospaced"); monospacedLabel.setText("monospaced");
monospacedLabel.putClientProperty("FlatLaf.styleClass", "monospaced"); monospacedLabel.putClientProperty("FlatLaf.styleClass", "monospaced");
add(monospacedLabel, "cell 1 15 5 1,gapx 30"); add(monospacedLabel, "cell 1 16 5 1,gapx 30");
//======== popupMenu1 ======== //======== popupMenu1 ========
{ {

View File

@@ -9,7 +9,7 @@ new FormModel {
add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) { add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) {
"$layoutConstraints": "insets dialog,hidemode 3" "$layoutConstraints": "insets dialog,hidemode 3"
"$columnConstraints": "[][sizegroup 1][sizegroup 1][sizegroup 1][][]" "$columnConstraints": "[][sizegroup 1][sizegroup 1][sizegroup 1][][]"
"$rowConstraints": "[][][][][][][][][][][][]para[][][][]" "$rowConstraints": "[][][][][][][][][][][][]para[][][][]0[]"
} ) { } ) {
name: "this" name: "this"
add( new FormComponent( "javax.swing.JLabel" ) { add( new FormComponent( "javax.swing.JLabel" ) {
@@ -719,46 +719,75 @@ new FormModel {
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 15 5 1" "value": "cell 1 15 5 1"
} ) } )
add( new FormComponent( "javax.swing.JLabel" ) {
name: "thinLabel"
"text": "thin"
"$client.FlatLaf.style": "font: 200% $thin.font"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 15 5 1,gapx 30"
} )
add( new FormComponent( "javax.swing.JLabel" ) {
name: "lightLabel"
"text": "light"
"$client.FlatLaf.style": "font: 200% $light.font"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 15 5 1"
} )
add( new FormComponent( "javax.swing.JLabel" ) {
name: "semiboldLabel"
"text": "semibold"
"$client.FlatLaf.style": "font: 200% $semibold.font"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 15 5 1"
} )
add( new FormComponent( "javax.swing.JLabel" ) {
name: "label3"
"text": "(200%)"
"$client.FlatLaf.styleClass": "small"
"enabled": false
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 15 5 1"
} )
add( new FormComponent( "javax.swing.JLabel" ) { add( new FormComponent( "javax.swing.JLabel" ) {
name: "largeLabel" name: "largeLabel"
"text": "large" "text": "large"
"$client.FlatLaf.styleClass": "large" "$client.FlatLaf.styleClass": "large"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 15 5 1,gapx 30" "value": "cell 1 16 5 1"
} ) } )
add( new FormComponent( "javax.swing.JLabel" ) { add( new FormComponent( "javax.swing.JLabel" ) {
name: "defaultLabel" name: "defaultLabel"
"text": "default/regular" "text": "default/regular"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 15 5 1" "value": "cell 1 16 5 1"
} ) } )
add( new FormComponent( "javax.swing.JLabel" ) { add( new FormComponent( "javax.swing.JLabel" ) {
name: "mediumLabel" name: "mediumLabel"
"text": "medium" "text": "medium"
"$client.FlatLaf.styleClass": "medium" "$client.FlatLaf.styleClass": "medium"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 15 5 1" "value": "cell 1 16 5 1"
} ) } )
add( new FormComponent( "javax.swing.JLabel" ) { add( new FormComponent( "javax.swing.JLabel" ) {
name: "smallLabel" name: "smallLabel"
"text": "small" "text": "small"
"$client.FlatLaf.styleClass": "small" "$client.FlatLaf.styleClass": "small"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 15 5 1" "value": "cell 1 16 5 1"
} ) } )
add( new FormComponent( "javax.swing.JLabel" ) { add( new FormComponent( "javax.swing.JLabel" ) {
name: "miniLabel" name: "miniLabel"
"text": "mini" "text": "mini"
"$client.FlatLaf.styleClass": "mini" "$client.FlatLaf.styleClass": "mini"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 15 5 1" "value": "cell 1 16 5 1"
} ) } )
add( new FormComponent( "javax.swing.JLabel" ) { add( new FormComponent( "javax.swing.JLabel" ) {
name: "monospacedLabel" name: "monospacedLabel"
"text": "monospaced" "text": "monospaced"
"$client.FlatLaf.styleClass": "monospaced" "$client.FlatLaf.styleClass": "monospaced"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 15 5 1,gapx 30" "value": "cell 1 16 5 1,gapx 30"
} ) } )
}, new FormLayoutConstraints( null ) { }, new FormLayoutConstraints( null ) {
"location": new java.awt.Point( 0, 0 ) "location": new java.awt.Point( 0, 0 )