mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2026-02-11 14:37:13 -06:00
fixed component heights at 1.25x, 1.75x and 2.25x scaling factors (Java 8 only) so that Button, ComboBox, Spinner and TextField components (including subclasses) have same heights
This commit is contained in:
@@ -51,6 +51,7 @@ public class FlatBaselineTest
|
||||
JFormattedTextField formattedTextField1 = new JFormattedTextField();
|
||||
JPasswordField passwordField1 = new JPasswordField();
|
||||
JComboBox<String> comboBox1 = new JComboBox<>();
|
||||
JComboBox<String> comboBox2 = new JComboBox<>();
|
||||
JSpinner spinner1 = new JSpinner();
|
||||
JLabel label6 = new JLabel();
|
||||
JScrollPane scrollPane1 = new JScrollPane();
|
||||
@@ -88,7 +89,7 @@ public class FlatBaselineTest
|
||||
|
||||
//======== this ========
|
||||
setLayout(new MigLayout(
|
||||
"insets dialog,hidemode 3,debug",
|
||||
"insets dialog,hidemode 3",
|
||||
// columns
|
||||
"[fill]" +
|
||||
"[fill]" +
|
||||
@@ -96,6 +97,7 @@ public class FlatBaselineTest
|
||||
"[fill]" +
|
||||
"[fill]" +
|
||||
"[fill]" +
|
||||
"[fill]" +
|
||||
"[fill]",
|
||||
// rows
|
||||
"[]" +
|
||||
@@ -130,7 +132,7 @@ public class FlatBaselineTest
|
||||
|
||||
//---- textField4 ----
|
||||
textField4.setText("Dext field");
|
||||
add(textField4, "cell 6 0");
|
||||
add(textField4, "cell 7 0");
|
||||
|
||||
//---- label2 ----
|
||||
label2.setText("Dext");
|
||||
@@ -147,8 +149,20 @@ public class FlatBaselineTest
|
||||
//---- passwordField1 ----
|
||||
passwordField1.setText("Dext");
|
||||
add(passwordField1, "cell 3 1");
|
||||
|
||||
//---- comboBox1 ----
|
||||
comboBox1.setModel(new DefaultComboBoxModel<>(new String[] {
|
||||
"Dext"
|
||||
}));
|
||||
add(comboBox1, "cell 4 1");
|
||||
add(spinner1, "cell 5 1");
|
||||
|
||||
//---- comboBox2 ----
|
||||
comboBox2.setModel(new DefaultComboBoxModel<>(new String[] {
|
||||
"Dext"
|
||||
}));
|
||||
comboBox2.setEditable(true);
|
||||
add(comboBox2, "cell 5 1");
|
||||
add(spinner1, "cell 6 1");
|
||||
|
||||
//---- label6 ----
|
||||
label6.setText("Dext");
|
||||
@@ -171,7 +185,7 @@ public class FlatBaselineTest
|
||||
|
||||
//---- textField2 ----
|
||||
textField2.setText("Dext field");
|
||||
add(textField2, "cell 6 2");
|
||||
add(textField2, "cell 7 2");
|
||||
|
||||
//---- label7 ----
|
||||
label7.setText("Dext");
|
||||
@@ -230,18 +244,18 @@ public class FlatBaselineTest
|
||||
|
||||
//---- textField3 ----
|
||||
textField3.setText("Dext field");
|
||||
add(textField3, "cell 6 3");
|
||||
add(textField3, "cell 7 3");
|
||||
|
||||
//---- label3 ----
|
||||
label3.setText("Dext");
|
||||
add(label3, "cell 0 4");
|
||||
add(slider1, "cell 1 4 6 1");
|
||||
add(slider1, "cell 1 4 7 1");
|
||||
|
||||
//---- slider6 ----
|
||||
slider6.setPaintTicks(true);
|
||||
slider6.setMajorTickSpacing(25);
|
||||
slider6.setMinorTickSpacing(5);
|
||||
add(slider6, "cell 1 4 6 1");
|
||||
add(slider6, "cell 1 4 7 1");
|
||||
|
||||
//---- label8 ----
|
||||
label8.setText("Dext");
|
||||
@@ -251,14 +265,14 @@ public class FlatBaselineTest
|
||||
slider7.setPaintLabels(true);
|
||||
slider7.setMajorTickSpacing(25);
|
||||
slider7.setMinorTickSpacing(5);
|
||||
add(slider7, "cell 1 5 6 1");
|
||||
add(slider7, "cell 1 5 7 1");
|
||||
|
||||
//---- slider8 ----
|
||||
slider8.setPaintLabels(true);
|
||||
slider8.setPaintTicks(true);
|
||||
slider8.setMajorTickSpacing(25);
|
||||
slider8.setMinorTickSpacing(5);
|
||||
add(slider8, "cell 1 5 6 1");
|
||||
add(slider8, "cell 1 5 7 1");
|
||||
|
||||
//---- label4 ----
|
||||
label4.setText("Dext");
|
||||
@@ -266,13 +280,13 @@ public class FlatBaselineTest
|
||||
|
||||
//---- progressBar1 ----
|
||||
progressBar1.setValue(30);
|
||||
add(progressBar1, "cell 1 6 6 1");
|
||||
add(progressBar1, "cell 1 6 7 1");
|
||||
|
||||
//---- progressBar3 ----
|
||||
progressBar3.setStringPainted(true);
|
||||
progressBar3.setValue(30);
|
||||
add(progressBar3, "cell 1 6 6 1");
|
||||
add(separator1, "cell 1 6 6 1");
|
||||
add(progressBar3, "cell 1 6 7 1");
|
||||
add(separator1, "cell 1 6 7 1");
|
||||
|
||||
//---- label5 ----
|
||||
label5.setText("Dext");
|
||||
@@ -280,26 +294,26 @@ public class FlatBaselineTest
|
||||
|
||||
//---- slider2 ----
|
||||
slider2.setOrientation(SwingConstants.VERTICAL);
|
||||
add(slider2, "cell 1 7 6 1");
|
||||
add(slider2, "cell 1 7 7 1");
|
||||
|
||||
//---- slider3 ----
|
||||
slider3.setOrientation(SwingConstants.VERTICAL);
|
||||
slider3.setPaintTicks(true);
|
||||
slider3.setMajorTickSpacing(25);
|
||||
slider3.setMinorTickSpacing(5);
|
||||
add(slider3, "cell 1 7 6 1");
|
||||
add(slider3, "cell 1 7 7 1");
|
||||
|
||||
//---- progressBar2 ----
|
||||
progressBar2.setOrientation(SwingConstants.VERTICAL);
|
||||
progressBar2.setValue(30);
|
||||
add(progressBar2, "cell 1 7 6 1");
|
||||
add(progressBar2, "cell 1 7 7 1");
|
||||
|
||||
//---- progressBar4 ----
|
||||
progressBar4.setOrientation(SwingConstants.VERTICAL);
|
||||
progressBar4.setStringPainted(true);
|
||||
progressBar4.setValue(30);
|
||||
add(progressBar4, "cell 1 7 6 1");
|
||||
add(hSpacer1, "cell 1 7 6 1,growx");
|
||||
add(progressBar4, "cell 1 7 7 1");
|
||||
add(hSpacer1, "cell 1 7 7 1,growx");
|
||||
|
||||
//---- label9 ----
|
||||
label9.setText("Dext");
|
||||
@@ -310,7 +324,7 @@ public class FlatBaselineTest
|
||||
slider4.setPaintLabels(true);
|
||||
slider4.setMajorTickSpacing(25);
|
||||
slider4.setMinorTickSpacing(5);
|
||||
add(slider4, "cell 1 8 6 1");
|
||||
add(slider4, "cell 1 8 7 1");
|
||||
|
||||
//---- slider5 ----
|
||||
slider5.setOrientation(SwingConstants.VERTICAL);
|
||||
@@ -318,8 +332,8 @@ public class FlatBaselineTest
|
||||
slider5.setPaintTicks(true);
|
||||
slider5.setMajorTickSpacing(25);
|
||||
slider5.setMinorTickSpacing(5);
|
||||
add(slider5, "cell 1 8 6 1");
|
||||
add(hSpacer2, "cell 1 8 6 1,growx");
|
||||
add(slider5, "cell 1 8 7 1");
|
||||
add(hSpacer2, "cell 1 8 7 1,growx");
|
||||
// JFormDesigner - End of component initialization //GEN-END:initComponents
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
JFDML JFormDesigner: "7.0.2.0.298" Java: "15" encoding: "UTF-8"
|
||||
JFDML JFormDesigner: "7.0.4.0.360" Java: "16" encoding: "UTF-8"
|
||||
|
||||
new FormModel {
|
||||
contentType: "form/swing"
|
||||
@@ -7,8 +7,8 @@ new FormModel {
|
||||
"JavaCodeGenerator.defaultVariableLocal": true
|
||||
}
|
||||
add( new FormContainer( "com.formdev.flatlaf.testing.FlatTestPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) {
|
||||
"$layoutConstraints": "insets dialog,hidemode 3,debug"
|
||||
"$columnConstraints": "[fill][fill][fill][fill][fill][fill][fill]"
|
||||
"$layoutConstraints": "insets dialog,hidemode 3"
|
||||
"$columnConstraints": "[fill][fill][fill][fill][fill][fill][fill][fill]"
|
||||
"$rowConstraints": "[][][50][::80][][][][][]"
|
||||
} ) {
|
||||
name: "this"
|
||||
@@ -46,7 +46,7 @@ new FormModel {
|
||||
name: "textField4"
|
||||
"text": "Dext field"
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 6 0"
|
||||
"value": "cell 7 0"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JLabel" ) {
|
||||
name: "label2"
|
||||
@@ -74,16 +74,33 @@ new FormModel {
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JComboBox" ) {
|
||||
name: "comboBox1"
|
||||
"model": new javax.swing.DefaultComboBoxModel {
|
||||
selectedItem: "Dext"
|
||||
addElement( "Dext" )
|
||||
}
|
||||
auxiliary() {
|
||||
"JavaCodeGenerator.typeParameters": "String"
|
||||
}
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 4 1"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JComboBox" ) {
|
||||
name: "comboBox2"
|
||||
"model": new javax.swing.DefaultComboBoxModel {
|
||||
selectedItem: "Dext"
|
||||
addElement( "Dext" )
|
||||
}
|
||||
"editable": true
|
||||
auxiliary() {
|
||||
"JavaCodeGenerator.typeParameters": "String"
|
||||
}
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 5 1"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JSpinner" ) {
|
||||
name: "spinner1"
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 5 1"
|
||||
"value": "cell 6 1"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JLabel" ) {
|
||||
name: "label6"
|
||||
@@ -112,7 +129,7 @@ new FormModel {
|
||||
name: "textField2"
|
||||
"text": "Dext field"
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 6 2"
|
||||
"value": "cell 7 2"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JLabel" ) {
|
||||
name: "label7"
|
||||
@@ -184,7 +201,7 @@ new FormModel {
|
||||
name: "textField3"
|
||||
"text": "Dext field"
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 6 3"
|
||||
"value": "cell 7 3"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JLabel" ) {
|
||||
name: "label3"
|
||||
@@ -195,7 +212,7 @@ new FormModel {
|
||||
add( new FormComponent( "javax.swing.JSlider" ) {
|
||||
name: "slider1"
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 1 4 6 1"
|
||||
"value": "cell 1 4 7 1"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JSlider" ) {
|
||||
name: "slider6"
|
||||
@@ -203,7 +220,7 @@ new FormModel {
|
||||
"majorTickSpacing": 25
|
||||
"minorTickSpacing": 5
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 1 4 6 1"
|
||||
"value": "cell 1 4 7 1"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JLabel" ) {
|
||||
name: "label8"
|
||||
@@ -217,7 +234,7 @@ new FormModel {
|
||||
"majorTickSpacing": 25
|
||||
"minorTickSpacing": 5
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 1 5 6 1"
|
||||
"value": "cell 1 5 7 1"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JSlider" ) {
|
||||
name: "slider8"
|
||||
@@ -226,7 +243,7 @@ new FormModel {
|
||||
"majorTickSpacing": 25
|
||||
"minorTickSpacing": 5
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 1 5 6 1"
|
||||
"value": "cell 1 5 7 1"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JLabel" ) {
|
||||
name: "label4"
|
||||
@@ -238,19 +255,19 @@ new FormModel {
|
||||
name: "progressBar1"
|
||||
"value": 30
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 1 6 6 1"
|
||||
"value": "cell 1 6 7 1"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JProgressBar" ) {
|
||||
name: "progressBar3"
|
||||
"stringPainted": true
|
||||
"value": 30
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 1 6 6 1"
|
||||
"value": "cell 1 6 7 1"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JSeparator" ) {
|
||||
name: "separator1"
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 1 6 6 1"
|
||||
"value": "cell 1 6 7 1"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JLabel" ) {
|
||||
name: "label5"
|
||||
@@ -262,7 +279,7 @@ new FormModel {
|
||||
name: "slider2"
|
||||
"orientation": 1
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 1 7 6 1"
|
||||
"value": "cell 1 7 7 1"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JSlider" ) {
|
||||
name: "slider3"
|
||||
@@ -271,14 +288,14 @@ new FormModel {
|
||||
"majorTickSpacing": 25
|
||||
"minorTickSpacing": 5
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 1 7 6 1"
|
||||
"value": "cell 1 7 7 1"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JProgressBar" ) {
|
||||
name: "progressBar2"
|
||||
"orientation": 1
|
||||
"value": 30
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 1 7 6 1"
|
||||
"value": "cell 1 7 7 1"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JProgressBar" ) {
|
||||
name: "progressBar4"
|
||||
@@ -286,12 +303,12 @@ new FormModel {
|
||||
"stringPainted": true
|
||||
"value": 30
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 1 7 6 1"
|
||||
"value": "cell 1 7 7 1"
|
||||
} )
|
||||
add( new FormComponent( "com.jformdesigner.designer.wrapper.HSpacer" ) {
|
||||
name: "hSpacer1"
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 1 7 6 1,growx"
|
||||
"value": "cell 1 7 7 1,growx"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JLabel" ) {
|
||||
name: "label9"
|
||||
@@ -306,7 +323,7 @@ new FormModel {
|
||||
"majorTickSpacing": 25
|
||||
"minorTickSpacing": 5
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 1 8 6 1"
|
||||
"value": "cell 1 8 7 1"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JSlider" ) {
|
||||
name: "slider5"
|
||||
@@ -316,12 +333,12 @@ new FormModel {
|
||||
"majorTickSpacing": 25
|
||||
"minorTickSpacing": 5
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 1 8 6 1"
|
||||
"value": "cell 1 8 7 1"
|
||||
} )
|
||||
add( new FormComponent( "com.jformdesigner.designer.wrapper.HSpacer" ) {
|
||||
name: "hSpacer2"
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 1 8 6 1,growx"
|
||||
"value": "cell 1 8 7 1,growx"
|
||||
} )
|
||||
}, new FormLayoutConstraints( null ) {
|
||||
"location": new java.awt.Point( 0, 0 )
|
||||
|
||||
Reference in New Issue
Block a user