Merge branch 'master' into branch 'custom-window-decorations'

This commit is contained in:
Karl Tauber
2020-06-23 11:11:14 +02:00
84 changed files with 5074 additions and 519 deletions

View File

@@ -347,12 +347,12 @@ public class FlatComponentsTest
add(labelLabel, "cell 0 0");
//---- label1 ----
label1.setText("enabled");
label1.setText("Enabled");
label1.setDisplayedMnemonic('E');
add(label1, "cell 1 0");
//---- label2 ----
label2.setText("disabled");
label2.setText("Disabled");
label2.setDisplayedMnemonic('D');
label2.setEnabled(false);
add(label2, "cell 2 0");
@@ -362,46 +362,46 @@ public class FlatComponentsTest
add(buttonLabel, "cell 0 1");
//---- button1 ----
button1.setText("enabled");
button1.setText("Enabled");
button1.setDisplayedMnemonicIndex(0);
button1.setToolTipText("This button is enabled.");
add(button1, "cell 1 1");
//---- button17 ----
button17.setText("sq");
button17.setText("Sq");
button17.putClientProperty("JButton.buttonType", "square");
button17.putClientProperty("JComponent.minimumWidth", 0);
add(button17, "cell 1 1");
//---- button22 ----
button22.setText("rd");
button22.setText("Rd");
button22.putClientProperty("JButton.buttonType", "roundRect");
button22.putClientProperty("JComponent.minimumWidth", 0);
add(button22, "cell 1 1");
//---- button2 ----
button2.setText("disabled");
button2.setText("Disabled");
button2.setDisplayedMnemonicIndex(0);
button2.setEnabled(false);
button2.setToolTipText("This button is disabled.");
add(button2, "cell 2 1");
//---- button18 ----
button18.setText("sq");
button18.setText("Sq");
button18.putClientProperty("JButton.buttonType", "square");
button18.setEnabled(false);
button18.putClientProperty("JComponent.minimumWidth", 0);
add(button18, "cell 2 1");
//---- button23 ----
button23.setText("rd");
button23.setText("Rd");
button23.putClientProperty("JButton.buttonType", "roundRect");
button23.setEnabled(false);
button23.putClientProperty("JComponent.minimumWidth", 0);
add(button23, "cell 2 1");
//---- button5 ----
button5.setText("default");
button5.setText("Default");
button5.setDisplayedMnemonicIndex(0);
button5.setToolTipText("Tool tip with\nmultiple\nlines.");
add(button5, "cell 3 1");
@@ -434,7 +434,7 @@ public class FlatComponentsTest
add(button16, "cell 5 1");
//---- button20 ----
button20.setText("empty border");
button20.setText("Empty border");
button20.setBorder(BorderFactory.createEmptyBorder());
add(button20, "cell 6 1");
@@ -443,43 +443,43 @@ public class FlatComponentsTest
add(toggleButtonLabel, "cell 0 2");
//---- toggleButton1 ----
toggleButton1.setText("enabled");
toggleButton1.setText("Enabled");
add(toggleButton1, "cell 1 2");
//---- toggleButton9 ----
toggleButton9.setText("sq");
toggleButton9.setText("Sq");
toggleButton9.putClientProperty("JButton.buttonType", "square");
add(toggleButton9, "cell 1 2");
//---- toggleButton19 ----
toggleButton19.setText("rd");
toggleButton19.setText("Rd");
toggleButton19.putClientProperty("JButton.buttonType", "roundRect");
add(toggleButton19, "cell 1 2");
//---- toggleButton2 ----
toggleButton2.setText("disabled");
toggleButton2.setText("Disabled");
toggleButton2.setEnabled(false);
add(toggleButton2, "cell 2 2");
//---- toggleButton10 ----
toggleButton10.setText("sq");
toggleButton10.setText("Sq");
toggleButton10.putClientProperty("JButton.buttonType", "square");
toggleButton10.setEnabled(false);
add(toggleButton10, "cell 2 2");
//---- toggleButton20 ----
toggleButton20.setText("rd");
toggleButton20.setText("Rd");
toggleButton20.putClientProperty("JButton.buttonType", "roundRect");
toggleButton20.setEnabled(false);
add(toggleButton20, "cell 2 2");
//---- toggleButton3 ----
toggleButton3.setText("selected");
toggleButton3.setText("Selected");
toggleButton3.setSelected(true);
add(toggleButton3, "cell 3 2");
//---- toggleButton4 ----
toggleButton4.setText("selected disabled");
toggleButton4.setText("Selected disabled");
toggleButton4.setEnabled(false);
toggleButton4.setSelected(true);
add(toggleButton4, "cell 4 2");
@@ -505,7 +505,7 @@ public class FlatComponentsTest
add(toggleButton14, "cell 5 2");
//---- toggleButton18 ----
toggleButton18.setText("empty border");
toggleButton18.setText("Empty border");
toggleButton18.setBorder(BorderFactory.createEmptyBorder());
add(toggleButton18, "cell 6 2");
@@ -514,35 +514,35 @@ public class FlatComponentsTest
add(checkBoxLabel, "cell 0 3");
//---- checkBox1 ----
checkBox1.setText("enabled");
checkBox1.setText("Enabled");
checkBox1.setMnemonic('A');
add(checkBox1, "cell 1 3");
//---- checkBox2 ----
checkBox2.setText("disabled");
checkBox2.setText("Disabled");
checkBox2.setEnabled(false);
checkBox2.setMnemonic('D');
add(checkBox2, "cell 2 3");
//---- checkBox3 ----
checkBox3.setText("selected");
checkBox3.setText("Selected");
checkBox3.setSelected(true);
add(checkBox3, "cell 3 3");
//---- checkBox4 ----
checkBox4.setText("selected disabled");
checkBox4.setText("Selected disabled");
checkBox4.setSelected(true);
checkBox4.setEnabled(false);
add(checkBox4, "cell 4 3");
//---- toggleButton5 ----
toggleButton5.setText("tab");
toggleButton5.setText("Tab");
toggleButton5.putClientProperty("JButton.buttonType", "tab");
toggleButton5.setSelected(true);
add(toggleButton5, "cell 5 3");
//---- toggleButton8 ----
toggleButton8.setText("tab");
toggleButton8.setText("Tab");
toggleButton8.putClientProperty("JButton.buttonType", "tab");
toggleButton8.setEnabled(false);
toggleButton8.setSelected(true);
@@ -553,23 +553,23 @@ public class FlatComponentsTest
add(radioButtonLabel, "cell 0 4");
//---- radioButton1 ----
radioButton1.setText("enabled");
radioButton1.setText("Enabled");
radioButton1.setMnemonic('N');
add(radioButton1, "cell 1 4");
//---- radioButton2 ----
radioButton2.setText("disabled");
radioButton2.setText("Disabled");
radioButton2.setEnabled(false);
radioButton2.setMnemonic('S');
add(radioButton2, "cell 2 4");
//---- radioButton3 ----
radioButton3.setText("selected");
radioButton3.setText("Selected");
radioButton3.setSelected(true);
add(radioButton3, "cell 3 4");
//---- radioButton4 ----
radioButton4.setText("selected disabled");
radioButton4.setText("Selected disabled");
radioButton4.setSelected(true);
radioButton4.setEnabled(false);
add(radioButton4, "cell 4 4");
@@ -581,7 +581,7 @@ public class FlatComponentsTest
//---- comboBox1 ----
comboBox1.setEditable(true);
comboBox1.setModel(new DefaultComboBoxModel<>(new String[] {
"editable",
"Editable",
"a",
"bb",
"ccc",
@@ -600,7 +600,7 @@ public class FlatComponentsTest
comboBox2.setEditable(true);
comboBox2.setEnabled(false);
comboBox2.setModel(new DefaultComboBoxModel<>(new String[] {
"disabled",
"Disabled",
"a",
"bb",
"ccc"
@@ -609,7 +609,7 @@ public class FlatComponentsTest
//---- comboBox3 ----
comboBox3.setModel(new DefaultComboBoxModel<>(new String[] {
"not editable",
"Not editable",
"a",
"bb",
"ccc",
@@ -626,7 +626,7 @@ public class FlatComponentsTest
//---- comboBox4 ----
comboBox4.setModel(new DefaultComboBoxModel<>(new String[] {
"not editable disabled",
"Not editable disabled",
"a",
"bb",
"ccc"
@@ -636,7 +636,7 @@ public class FlatComponentsTest
//---- comboBox5 ----
comboBox5.setModel(new DefaultComboBoxModel<>(new String[] {
"wide popup if text is longer",
"Wide popup if text is longer",
"aa",
"bbb",
"cccc"
@@ -646,7 +646,7 @@ public class FlatComponentsTest
//---- comboBox6 ----
comboBox6.setBorder(BorderFactory.createEmptyBorder());
comboBox6.setModel(new DefaultComboBoxModel<>(new String[] {
"empty border",
"Empty border",
"a",
"b",
"c"
@@ -664,7 +664,7 @@ public class FlatComponentsTest
//---- comboBox7 ----
comboBox7.setEditable(true);
comboBox7.putClientProperty("JTextField.placeholderText", "placeholder");
comboBox7.putClientProperty("JTextField.placeholderText", "Placeholder");
add(comboBox7, "cell 5 6,growx");
//---- spinner3 ----
@@ -677,31 +677,31 @@ public class FlatComponentsTest
add(textFieldLabel, "cell 0 7");
//---- textField1 ----
textField1.setText("editable");
textField1.setText("Editable");
add(textField1, "cell 1 7,growx");
//---- textField2 ----
textField2.setText("disabled");
textField2.setText("Disabled");
textField2.setEnabled(false);
add(textField2, "cell 2 7,growx");
//---- textField3 ----
textField3.setText("not editable");
textField3.setText("Not editable");
textField3.setEditable(false);
add(textField3, "cell 3 7,growx");
//---- textField4 ----
textField4.setText("not editable disabled");
textField4.setText("Not editable disabled");
textField4.setEnabled(false);
textField4.setEditable(false);
add(textField4, "cell 4 7,growx");
//---- textField6 ----
textField6.putClientProperty("JTextField.placeholderText", "placeholder");
textField6.putClientProperty("JTextField.placeholderText", "Placeholder");
add(textField6, "cell 5 7,growx");
//---- textField5 ----
textField5.setText("empty border");
textField5.setText("Empty border");
textField5.setBorder(BorderFactory.createEmptyBorder());
add(textField5, "cell 6 7");
@@ -710,31 +710,31 @@ public class FlatComponentsTest
add(formattedTextFieldLabel, "cell 0 8");
//---- formattedTextField1 ----
formattedTextField1.setText("editable");
formattedTextField1.setText("Editable");
add(formattedTextField1, "cell 1 8,growx");
//---- formattedTextField2 ----
formattedTextField2.setText("disabled");
formattedTextField2.setText("Disabled");
formattedTextField2.setEnabled(false);
add(formattedTextField2, "cell 2 8,growx");
//---- formattedTextField3 ----
formattedTextField3.setText("not editable");
formattedTextField3.setText("Not editable");
formattedTextField3.setEditable(false);
add(formattedTextField3, "cell 3 8,growx");
//---- formattedTextField4 ----
formattedTextField4.setText("not editable disabled");
formattedTextField4.setText("Not editable disabled");
formattedTextField4.setEnabled(false);
formattedTextField4.setEditable(false);
add(formattedTextField4, "cell 4 8,growx");
//---- formattedTextField5 ----
formattedTextField5.putClientProperty("JTextField.placeholderText", "placeholder");
formattedTextField5.putClientProperty("JTextField.placeholderText", "Placeholder");
add(formattedTextField5, "cell 5 8,growx");
//---- formattedTextField6 ----
formattedTextField6.setText("empty border");
formattedTextField6.setText("Empty border");
formattedTextField6.setBorder(BorderFactory.createEmptyBorder());
add(formattedTextField6, "cell 6 8");
@@ -743,27 +743,27 @@ public class FlatComponentsTest
add(passwordFieldLabel, "cell 0 9");
//---- passwordField1 ----
passwordField1.setText("editable");
passwordField1.setText("Editable");
add(passwordField1, "cell 1 9,growx");
//---- passwordField2 ----
passwordField2.setText("disabled");
passwordField2.setText("Disabled");
passwordField2.setEnabled(false);
add(passwordField2, "cell 2 9,growx");
//---- passwordField3 ----
passwordField3.setText("not editable");
passwordField3.setText("Not editable");
passwordField3.setEditable(false);
add(passwordField3, "cell 3 9,growx");
//---- passwordField4 ----
passwordField4.setText("not editable disabled");
passwordField4.setText("Not editable disabled");
passwordField4.setEnabled(false);
passwordField4.setEditable(false);
add(passwordField4, "cell 4 9,growx");
//---- passwordField5 ----
passwordField5.putClientProperty("JTextField.placeholderText", "placeholder");
passwordField5.putClientProperty("JTextField.placeholderText", "Placeholder");
add(passwordField5, "cell 5 9,growx");
//---- passwordField6 ----
@@ -781,7 +781,7 @@ public class FlatComponentsTest
scrollPane1.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
//---- textArea1 ----
textArea1.setText("editable");
textArea1.setText("Editable");
textArea1.setRows(2);
scrollPane1.setViewportView(textArea1);
}
@@ -793,7 +793,7 @@ public class FlatComponentsTest
scrollPane2.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
//---- textArea2 ----
textArea2.setText("disabled");
textArea2.setText("Disabled");
textArea2.setRows(2);
textArea2.setEnabled(false);
scrollPane2.setViewportView(textArea2);
@@ -806,7 +806,7 @@ public class FlatComponentsTest
scrollPane3.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
//---- textArea3 ----
textArea3.setText("not editable");
textArea3.setText("Not editable");
textArea3.setRows(2);
textArea3.setEditable(false);
scrollPane3.setViewportView(textArea3);
@@ -819,7 +819,7 @@ public class FlatComponentsTest
scrollPane4.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
//---- textArea4 ----
textArea4.setText("not editable disabled");
textArea4.setText("Not editable disabled");
textArea4.setRows(2);
textArea4.setEditable(false);
textArea4.setEnabled(false);
@@ -829,7 +829,7 @@ public class FlatComponentsTest
//---- textArea5 ----
textArea5.setRows(2);
textArea5.setText("no scroll pane");
textArea5.setText("No scroll pane");
add(textArea5, "cell 5 10,growx");
//---- editorPaneLabel ----
@@ -842,7 +842,7 @@ public class FlatComponentsTest
scrollPane5.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
//---- editorPane1 ----
editorPane1.setText("editable");
editorPane1.setText("Editable");
scrollPane5.setViewportView(editorPane1);
}
add(scrollPane5, "cell 1 11,growx");
@@ -853,7 +853,7 @@ public class FlatComponentsTest
scrollPane6.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
//---- editorPane2 ----
editorPane2.setText("disabled");
editorPane2.setText("Disabled");
editorPane2.setEnabled(false);
scrollPane6.setViewportView(editorPane2);
}
@@ -865,7 +865,7 @@ public class FlatComponentsTest
scrollPane7.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
//---- editorPane3 ----
editorPane3.setText("not editable");
editorPane3.setText("Not editable");
editorPane3.setEditable(false);
scrollPane7.setViewportView(editorPane3);
}
@@ -877,7 +877,7 @@ public class FlatComponentsTest
scrollPane8.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
//---- editorPane4 ----
editorPane4.setText("not editable disabled");
editorPane4.setText("Not editable disabled");
editorPane4.setEditable(false);
editorPane4.setEnabled(false);
scrollPane8.setViewportView(editorPane4);
@@ -885,7 +885,7 @@ public class FlatComponentsTest
add(scrollPane8, "cell 4 11,growx");
//---- editorPane5 ----
editorPane5.setText("no scroll pane");
editorPane5.setText("No scroll pane");
add(editorPane5, "cell 5 11,growx");
//---- textPaneLabel ----
@@ -898,7 +898,7 @@ public class FlatComponentsTest
scrollPane9.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
//---- textPane1 ----
textPane1.setText("editable");
textPane1.setText("Editable");
scrollPane9.setViewportView(textPane1);
}
add(scrollPane9, "cell 1 12,growx");
@@ -909,7 +909,7 @@ public class FlatComponentsTest
scrollPane10.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
//---- textPane2 ----
textPane2.setText("disabled");
textPane2.setText("Disabled");
textPane2.setEnabled(false);
scrollPane10.setViewportView(textPane2);
}
@@ -921,7 +921,7 @@ public class FlatComponentsTest
scrollPane11.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
//---- textPane3 ----
textPane3.setText("not editable");
textPane3.setText("Not editable");
textPane3.setEditable(false);
scrollPane11.setViewportView(textPane3);
}
@@ -933,7 +933,7 @@ public class FlatComponentsTest
scrollPane12.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
//---- textPane4 ----
textPane4.setText("not editable disabled");
textPane4.setText("Not editable disabled");
textPane4.setEditable(false);
textPane4.setEnabled(false);
scrollPane12.setViewportView(textPane4);
@@ -941,7 +941,7 @@ public class FlatComponentsTest
add(scrollPane12, "cell 4 12,growx");
//---- textPane5 ----
textPane5.setText("no scroll pane");
textPane5.setText("No scroll pane");
add(textPane5, "cell 5 12,growx");
//---- scrollPaneLabel ----

View File

@@ -1,4 +1,4 @@
JFDML JFormDesigner: "7.0.1.0.272" Java: "13.0.2" encoding: "UTF-8"
JFDML JFormDesigner: "7.0.2.0.298" Java: "14" encoding: "UTF-8"
new FormModel {
contentType: "form/swing"
@@ -20,14 +20,14 @@ new FormModel {
} )
add( new FormComponent( "javax.swing.JLabel" ) {
name: "label1"
"text": "enabled"
"text": "Enabled"
"displayedMnemonic": 69
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 0"
} )
add( new FormComponent( "javax.swing.JLabel" ) {
name: "label2"
"text": "disabled"
"text": "Disabled"
"displayedMnemonic": 68
"enabled": false
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
@@ -41,7 +41,7 @@ new FormModel {
} )
add( new FormComponent( "javax.swing.JButton" ) {
name: "button1"
"text": "enabled"
"text": "Enabled"
"displayedMnemonicIndex": 0
"toolTipText": "This button is enabled."
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
@@ -49,7 +49,7 @@ new FormModel {
} )
add( new FormComponent( "javax.swing.JButton" ) {
name: "button17"
"text": "sq"
"text": "Sq"
"$client.JButton.buttonType": "square"
"$client.JComponent.minimumWidth": 0
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
@@ -57,7 +57,7 @@ new FormModel {
} )
add( new FormComponent( "javax.swing.JButton" ) {
name: "button22"
"text": "rd"
"text": "Rd"
"$client.JButton.buttonType": "roundRect"
"$client.JComponent.minimumWidth": 0
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
@@ -65,7 +65,7 @@ new FormModel {
} )
add( new FormComponent( "javax.swing.JButton" ) {
name: "button2"
"text": "disabled"
"text": "Disabled"
"displayedMnemonicIndex": 0
"enabled": false
"toolTipText": "This button is disabled."
@@ -74,7 +74,7 @@ new FormModel {
} )
add( new FormComponent( "javax.swing.JButton" ) {
name: "button18"
"text": "sq"
"text": "Sq"
"$client.JButton.buttonType": "square"
"enabled": false
"$client.JComponent.minimumWidth": 0
@@ -83,7 +83,7 @@ new FormModel {
} )
add( new FormComponent( "javax.swing.JButton" ) {
name: "button23"
"text": "rd"
"text": "Rd"
"$client.JButton.buttonType": "roundRect"
"enabled": false
"$client.JComponent.minimumWidth": 0
@@ -92,7 +92,7 @@ new FormModel {
} )
add( new FormComponent( "com.formdev.flatlaf.testing.FlatComponentsTest$TestDefaultButton" ) {
name: "button5"
"text": "default"
"text": "Default"
"displayedMnemonicIndex": 0
"toolTipText": "Tool tip with\nmultiple\nlines."
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
@@ -139,7 +139,7 @@ new FormModel {
} )
add( new FormComponent( "javax.swing.JButton" ) {
name: "button20"
"text": "empty border"
"text": "Empty border"
"border": &EmptyBorder0 new javax.swing.border.EmptyBorder( 0, 0, 0, 0 )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 6 1"
@@ -152,34 +152,34 @@ new FormModel {
} )
add( new FormComponent( "javax.swing.JToggleButton" ) {
name: "toggleButton1"
"text": "enabled"
"text": "Enabled"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 2"
} )
add( new FormComponent( "javax.swing.JToggleButton" ) {
name: "toggleButton9"
"text": "sq"
"text": "Sq"
"$client.JButton.buttonType": "square"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 2"
} )
add( new FormComponent( "javax.swing.JToggleButton" ) {
name: "toggleButton19"
"text": "rd"
"text": "Rd"
"$client.JButton.buttonType": "roundRect"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 2"
} )
add( new FormComponent( "javax.swing.JToggleButton" ) {
name: "toggleButton2"
"text": "disabled"
"text": "Disabled"
"enabled": false
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 2 2"
} )
add( new FormComponent( "javax.swing.JToggleButton" ) {
name: "toggleButton10"
"text": "sq"
"text": "Sq"
"$client.JButton.buttonType": "square"
"enabled": false
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
@@ -187,7 +187,7 @@ new FormModel {
} )
add( new FormComponent( "javax.swing.JToggleButton" ) {
name: "toggleButton20"
"text": "rd"
"text": "Rd"
"$client.JButton.buttonType": "roundRect"
"enabled": false
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
@@ -195,14 +195,14 @@ new FormModel {
} )
add( new FormComponent( "javax.swing.JToggleButton" ) {
name: "toggleButton3"
"text": "selected"
"text": "Selected"
"selected": true
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 3 2"
} )
add( new FormComponent( "javax.swing.JToggleButton" ) {
name: "toggleButton4"
"text": "selected disabled"
"text": "Selected disabled"
"enabled": false
"selected": true
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
@@ -238,7 +238,7 @@ new FormModel {
} )
add( new FormComponent( "javax.swing.JToggleButton" ) {
name: "toggleButton18"
"text": "empty border"
"text": "Empty border"
"border": #EmptyBorder0
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 6 2"
@@ -251,14 +251,14 @@ new FormModel {
} )
add( new FormComponent( "javax.swing.JCheckBox" ) {
name: "checkBox1"
"text": "enabled"
"text": "Enabled"
"mnemonic": 65
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 3"
} )
add( new FormComponent( "javax.swing.JCheckBox" ) {
name: "checkBox2"
"text": "disabled"
"text": "Disabled"
"enabled": false
"mnemonic": 68
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
@@ -266,14 +266,14 @@ new FormModel {
} )
add( new FormComponent( "javax.swing.JCheckBox" ) {
name: "checkBox3"
"text": "selected"
"text": "Selected"
"selected": true
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 3 3"
} )
add( new FormComponent( "javax.swing.JCheckBox" ) {
name: "checkBox4"
"text": "selected disabled"
"text": "Selected disabled"
"selected": true
"enabled": false
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
@@ -281,7 +281,7 @@ new FormModel {
} )
add( new FormComponent( "javax.swing.JToggleButton" ) {
name: "toggleButton5"
"text": "tab"
"text": "Tab"
"$client.JButton.buttonType": "tab"
"selected": true
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
@@ -289,7 +289,7 @@ new FormModel {
} )
add( new FormComponent( "javax.swing.JToggleButton" ) {
name: "toggleButton8"
"text": "tab"
"text": "Tab"
"$client.JButton.buttonType": "tab"
"enabled": false
"selected": true
@@ -304,14 +304,14 @@ new FormModel {
} )
add( new FormComponent( "javax.swing.JRadioButton" ) {
name: "radioButton1"
"text": "enabled"
"text": "Enabled"
"mnemonic": 78
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 4"
} )
add( new FormComponent( "javax.swing.JRadioButton" ) {
name: "radioButton2"
"text": "disabled"
"text": "Disabled"
"enabled": false
"mnemonic": 83
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
@@ -319,14 +319,14 @@ new FormModel {
} )
add( new FormComponent( "javax.swing.JRadioButton" ) {
name: "radioButton3"
"text": "selected"
"text": "Selected"
"selected": true
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 3 4"
} )
add( new FormComponent( "javax.swing.JRadioButton" ) {
name: "radioButton4"
"text": "selected disabled"
"text": "Selected disabled"
"selected": true
"enabled": false
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
@@ -342,8 +342,8 @@ new FormModel {
name: "comboBox1"
"editable": true
"model": new javax.swing.DefaultComboBoxModel {
selectedItem: "editable"
addElement( "editable" )
selectedItem: "Editable"
addElement( "Editable" )
addElement( "a" )
addElement( "bb" )
addElement( "ccc" )
@@ -364,8 +364,8 @@ new FormModel {
"editable": true
"enabled": false
"model": new javax.swing.DefaultComboBoxModel {
selectedItem: "disabled"
addElement( "disabled" )
selectedItem: "Disabled"
addElement( "Disabled" )
addElement( "a" )
addElement( "bb" )
addElement( "ccc" )
@@ -376,8 +376,8 @@ new FormModel {
add( new FormComponent( "javax.swing.JComboBox" ) {
name: "comboBox3"
"model": new javax.swing.DefaultComboBoxModel {
selectedItem: "not editable"
addElement( "not editable" )
selectedItem: "Not editable"
addElement( "Not editable" )
addElement( "a" )
addElement( "bb" )
addElement( "ccc" )
@@ -396,8 +396,8 @@ new FormModel {
add( new FormComponent( "javax.swing.JComboBox" ) {
name: "comboBox4"
"model": new javax.swing.DefaultComboBoxModel {
selectedItem: "not editable disabled"
addElement( "not editable disabled" )
selectedItem: "Not editable disabled"
addElement( "Not editable disabled" )
addElement( "a" )
addElement( "bb" )
addElement( "ccc" )
@@ -409,8 +409,8 @@ new FormModel {
add( new FormComponent( "javax.swing.JComboBox" ) {
name: "comboBox5"
"model": new javax.swing.DefaultComboBoxModel {
selectedItem: "wide popup if text is longer"
addElement( "wide popup if text is longer" )
selectedItem: "Wide popup if text is longer"
addElement( "Wide popup if text is longer" )
addElement( "aa" )
addElement( "bbb" )
addElement( "cccc" )
@@ -422,8 +422,8 @@ new FormModel {
name: "comboBox6"
"border": #EmptyBorder0
"model": new javax.swing.DefaultComboBoxModel {
selectedItem: "empty border"
addElement( "empty border" )
selectedItem: "Empty border"
addElement( "Empty border" )
addElement( "a" )
addElement( "b" )
addElement( "c" )
@@ -451,7 +451,7 @@ new FormModel {
add( new FormComponent( "javax.swing.JComboBox" ) {
name: "comboBox7"
"editable": true
"$client.JTextField.placeholderText": "placeholder"
"$client.JTextField.placeholderText": "Placeholder"
auxiliary() {
"JavaCodeGenerator.typeParameters": "String"
}
@@ -475,7 +475,7 @@ new FormModel {
} )
add( new FormComponent( "javax.swing.JTextField" ) {
name: "textField1"
"text": "editable"
"text": "Editable"
auxiliary() {
"JavaCodeGenerator.variableLocal": false
}
@@ -484,21 +484,21 @@ new FormModel {
} )
add( new FormComponent( "javax.swing.JTextField" ) {
name: "textField2"
"text": "disabled"
"text": "Disabled"
"enabled": false
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 2 7,growx"
} )
add( new FormComponent( "javax.swing.JTextField" ) {
name: "textField3"
"text": "not editable"
"text": "Not editable"
"editable": false
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 3 7,growx"
} )
add( new FormComponent( "javax.swing.JTextField" ) {
name: "textField4"
"text": "not editable disabled"
"text": "Not editable disabled"
"enabled": false
"editable": false
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
@@ -506,13 +506,13 @@ new FormModel {
} )
add( new FormComponent( "javax.swing.JTextField" ) {
name: "textField6"
"$client.JTextField.placeholderText": "placeholder"
"$client.JTextField.placeholderText": "Placeholder"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 5 7,growx"
} )
add( new FormComponent( "javax.swing.JTextField" ) {
name: "textField5"
"text": "empty border"
"text": "Empty border"
"border": #EmptyBorder0
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 6 7"
@@ -525,27 +525,27 @@ new FormModel {
} )
add( new FormComponent( "javax.swing.JFormattedTextField" ) {
name: "formattedTextField1"
"text": "editable"
"text": "Editable"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 8,growx"
} )
add( new FormComponent( "javax.swing.JFormattedTextField" ) {
name: "formattedTextField2"
"text": "disabled"
"text": "Disabled"
"enabled": false
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 2 8,growx"
} )
add( new FormComponent( "javax.swing.JFormattedTextField" ) {
name: "formattedTextField3"
"text": "not editable"
"text": "Not editable"
"editable": false
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 3 8,growx"
} )
add( new FormComponent( "javax.swing.JFormattedTextField" ) {
name: "formattedTextField4"
"text": "not editable disabled"
"text": "Not editable disabled"
"enabled": false
"editable": false
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
@@ -553,13 +553,13 @@ new FormModel {
} )
add( new FormComponent( "javax.swing.JFormattedTextField" ) {
name: "formattedTextField5"
"$client.JTextField.placeholderText": "placeholder"
"$client.JTextField.placeholderText": "Placeholder"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 5 8,growx"
} )
add( new FormComponent( "javax.swing.JFormattedTextField" ) {
name: "formattedTextField6"
"text": "empty border"
"text": "Empty border"
"border": #EmptyBorder0
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 6 8"
@@ -572,27 +572,27 @@ new FormModel {
} )
add( new FormComponent( "javax.swing.JPasswordField" ) {
name: "passwordField1"
"text": "editable"
"text": "Editable"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 9,growx"
} )
add( new FormComponent( "javax.swing.JPasswordField" ) {
name: "passwordField2"
"text": "disabled"
"text": "Disabled"
"enabled": false
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 2 9,growx"
} )
add( new FormComponent( "javax.swing.JPasswordField" ) {
name: "passwordField3"
"text": "not editable"
"text": "Not editable"
"editable": false
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 3 9,growx"
} )
add( new FormComponent( "javax.swing.JPasswordField" ) {
name: "passwordField4"
"text": "not editable disabled"
"text": "Not editable disabled"
"enabled": false
"editable": false
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
@@ -600,7 +600,7 @@ new FormModel {
} )
add( new FormComponent( "javax.swing.JPasswordField" ) {
name: "passwordField5"
"$client.JTextField.placeholderText": "placeholder"
"$client.JTextField.placeholderText": "Placeholder"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 5 9,growx"
} )
@@ -623,7 +623,7 @@ new FormModel {
"horizontalScrollBarPolicy": 31
add( new FormComponent( "javax.swing.JTextArea" ) {
name: "textArea1"
"text": "editable"
"text": "Editable"
"rows": 2
} )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
@@ -635,7 +635,7 @@ new FormModel {
"horizontalScrollBarPolicy": 31
add( new FormComponent( "javax.swing.JTextArea" ) {
name: "textArea2"
"text": "disabled"
"text": "Disabled"
"rows": 2
"enabled": false
} )
@@ -648,7 +648,7 @@ new FormModel {
"horizontalScrollBarPolicy": 31
add( new FormComponent( "javax.swing.JTextArea" ) {
name: "textArea3"
"text": "not editable"
"text": "Not editable"
"rows": 2
"editable": false
} )
@@ -661,7 +661,7 @@ new FormModel {
"horizontalScrollBarPolicy": 31
add( new FormComponent( "javax.swing.JTextArea" ) {
name: "textArea4"
"text": "not editable disabled"
"text": "Not editable disabled"
"rows": 2
"editable": false
"enabled": false
@@ -672,7 +672,7 @@ new FormModel {
add( new FormComponent( "javax.swing.JTextArea" ) {
name: "textArea5"
"rows": 2
"text": "no scroll pane"
"text": "No scroll pane"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 5 10,growx"
} )
@@ -688,7 +688,7 @@ new FormModel {
"horizontalScrollBarPolicy": 31
add( new FormComponent( "javax.swing.JEditorPane" ) {
name: "editorPane1"
"text": "editable"
"text": "Editable"
} )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 11,growx"
@@ -699,7 +699,7 @@ new FormModel {
"horizontalScrollBarPolicy": 31
add( new FormComponent( "javax.swing.JEditorPane" ) {
name: "editorPane2"
"text": "disabled"
"text": "Disabled"
"enabled": false
} )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
@@ -711,7 +711,7 @@ new FormModel {
"horizontalScrollBarPolicy": 31
add( new FormComponent( "javax.swing.JEditorPane" ) {
name: "editorPane3"
"text": "not editable"
"text": "Not editable"
"editable": false
} )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
@@ -723,7 +723,7 @@ new FormModel {
"horizontalScrollBarPolicy": 31
add( new FormComponent( "javax.swing.JEditorPane" ) {
name: "editorPane4"
"text": "not editable disabled"
"text": "Not editable disabled"
"editable": false
"enabled": false
} )
@@ -732,7 +732,7 @@ new FormModel {
} )
add( new FormComponent( "javax.swing.JEditorPane" ) {
name: "editorPane5"
"text": "no scroll pane"
"text": "No scroll pane"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 5 11,growx"
} )
@@ -748,7 +748,7 @@ new FormModel {
"horizontalScrollBarPolicy": 31
add( new FormComponent( "javax.swing.JTextPane" ) {
name: "textPane1"
"text": "editable"
"text": "Editable"
} )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 12,growx"
@@ -759,7 +759,7 @@ new FormModel {
"horizontalScrollBarPolicy": 31
add( new FormComponent( "javax.swing.JTextPane" ) {
name: "textPane2"
"text": "disabled"
"text": "Disabled"
"enabled": false
} )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
@@ -771,7 +771,7 @@ new FormModel {
"horizontalScrollBarPolicy": 31
add( new FormComponent( "javax.swing.JTextPane" ) {
name: "textPane3"
"text": "not editable"
"text": "Not editable"
"editable": false
} )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
@@ -783,7 +783,7 @@ new FormModel {
"horizontalScrollBarPolicy": 31
add( new FormComponent( "javax.swing.JTextPane" ) {
name: "textPane4"
"text": "not editable disabled"
"text": "Not editable disabled"
"editable": false
"enabled": false
} )
@@ -792,7 +792,7 @@ new FormModel {
} )
add( new FormComponent( "javax.swing.JTextPane" ) {
name: "textPane5"
"text": "no scroll pane"
"text": "No scroll pane"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 5 12,growx"
} )

View File

@@ -58,6 +58,34 @@ public class FlatHtmlTest
editorPaneLabel = new JLabel();
textPaneLabel = new JLabel();
toolTipLabel = new JLabel();
panel1 = new JPanel();
label5 = new JLabel();
label6 = new JLabel();
label7 = new JLabel();
label3 = new JLabel();
button1 = new JButton();
button2 = new JButton();
label11 = new JLabel();
toggleButton1 = new JToggleButton();
toggleButton2 = new JToggleButton();
label12 = new JLabel();
checkBox1 = new JCheckBox();
checkBox2 = new JCheckBox();
label13 = new JLabel();
radioButton1 = new JRadioButton();
radioButton2 = new JRadioButton();
label8 = new JLabel();
menu1 = new JMenu();
menu2 = new JMenu();
label4 = new JLabel();
menuItem1 = new JMenuItem();
menuItem2 = new JMenuItem();
label9 = new JLabel();
checkBoxMenuItem1 = new JCheckBoxMenuItem();
checkBoxMenuItem2 = new JCheckBoxMenuItem();
label10 = new JLabel();
radioButtonMenuItem1 = new JRadioButtonMenuItem();
radioButtonMenuItem2 = new JRadioButtonMenuItem();
label1 = new JLabel();
scrollPane15 = new JScrollPane();
editorPane1 = new JEditorPane();
@@ -78,6 +106,7 @@ public class FlatHtmlTest
"[fill]" +
"[fill]" +
"[fill]" +
"[fill]" +
"[fill]",
// rows
"[]" +
@@ -100,6 +129,145 @@ public class FlatHtmlTest
toolTipLabel.setText("JToolTip:");
add(toolTipLabel, "cell 3 0");
//======== panel1 ========
{
panel1.setLayout(new MigLayout(
"insets 0,hidemode 3",
// columns
"[fill]" +
"[fill]" +
"[fill]",
// rows
"[]" +
"[]" +
"[]" +
"[]" +
"[]" +
"[]" +
"[]" +
"[]" +
"[]"));
//---- label5 ----
label5.setText("JLabel:");
panel1.add(label5, "cell 0 0");
//---- label6 ----
label6.setText("<html>Some <b>Bold</b> Text");
panel1.add(label6, "cell 1 0");
//---- label7 ----
label7.setText("Some text");
panel1.add(label7, "cell 2 0");
//---- label3 ----
label3.setText("JButon:");
panel1.add(label3, "cell 0 1");
//---- button1 ----
button1.setText("<html>Some <b>Bold</b> Text");
panel1.add(button1, "cell 1 1");
//---- button2 ----
button2.setText("Some text");
panel1.add(button2, "cell 2 1");
//---- label11 ----
label11.setText("text");
panel1.add(label11, "cell 0 2");
//---- toggleButton1 ----
toggleButton1.setText("<html>Some <b>Bold</b> Text");
toggleButton1.setSelected(true);
panel1.add(toggleButton1, "cell 1 2");
//---- toggleButton2 ----
toggleButton2.setText("Some text");
toggleButton2.setSelected(true);
panel1.add(toggleButton2, "cell 2 2");
//---- label12 ----
label12.setText("text");
panel1.add(label12, "cell 0 3");
//---- checkBox1 ----
checkBox1.setText("<html>Some <b>Bold</b> Text");
panel1.add(checkBox1, "cell 1 3");
//---- checkBox2 ----
checkBox2.setText("Some text");
panel1.add(checkBox2, "cell 2 3");
//---- label13 ----
label13.setText("text");
panel1.add(label13, "cell 0 4");
//---- radioButton1 ----
radioButton1.setText("<html>Some <b>Bold</b> Text");
panel1.add(radioButton1, "cell 1 4");
//---- radioButton2 ----
radioButton2.setText("Some text");
panel1.add(radioButton2, "cell 2 4");
//---- label8 ----
label8.setText("JMenu:");
panel1.add(label8, "cell 0 5");
//======== menu1 ========
{
menu1.setText("<html>Some <b>Bold</b> Text");
}
panel1.add(menu1, "cell 1 5");
//======== menu2 ========
{
menu2.setText("Some text");
}
panel1.add(menu2, "cell 2 5");
//---- label4 ----
label4.setText("JMenuItem:");
panel1.add(label4, "cell 0 6");
//---- menuItem1 ----
menuItem1.setText("<html>Some <b>Bold</b> Text");
panel1.add(menuItem1, "cell 1 6");
//---- menuItem2 ----
menuItem2.setText("Some text");
panel1.add(menuItem2, "cell 2 6");
//---- label9 ----
label9.setText("JCheckBoxMenuItem:");
panel1.add(label9, "cell 0 7");
//---- checkBoxMenuItem1 ----
checkBoxMenuItem1.setText("<html>Some <b>Bold</b> Text");
checkBoxMenuItem1.setSelected(true);
panel1.add(checkBoxMenuItem1, "cell 1 7");
//---- checkBoxMenuItem2 ----
checkBoxMenuItem2.setText("Some text");
checkBoxMenuItem2.setSelected(true);
panel1.add(checkBoxMenuItem2, "cell 2 7");
//---- label10 ----
label10.setText("JRadioButtonMenuItem:");
panel1.add(label10, "cell 0 8");
//---- radioButtonMenuItem1 ----
radioButtonMenuItem1.setText("<html>Some <b>Bold</b> Text");
radioButtonMenuItem1.setSelected(true);
panel1.add(radioButtonMenuItem1, "cell 1 8");
//---- radioButtonMenuItem2 ----
radioButtonMenuItem2.setText("Some text");
radioButtonMenuItem2.setSelected(true);
panel1.add(radioButtonMenuItem2, "cell 2 8");
}
add(panel1, "cell 4 0 1 3,aligny top,growy 0");
//---- label1 ----
label1.setText("<html>HTML<br>Sample <b>content</b><br> <u>text</u> with <a href=\"#\">link</a><h1>Header 1</h1><h2>Header 2</h2><h3>Header 3</h3><h4>Header 4</h4><h5>Header 5</h5><h6>Header 6</h6><p>Paragraph</p><hr><table border=\"1\"><tr><th>Col 1</th><th>Col 2</th></tr><tr><td>abc</td><td>def</td></tr></table><ul><li>item 1</li><li>item 2</li></ul></html>");
add(label1, "cell 0 1");
@@ -183,6 +351,34 @@ public class FlatHtmlTest
private JLabel editorPaneLabel;
private JLabel textPaneLabel;
private JLabel toolTipLabel;
private JPanel panel1;
private JLabel label5;
private JLabel label6;
private JLabel label7;
private JLabel label3;
private JButton button1;
private JButton button2;
private JLabel label11;
private JToggleButton toggleButton1;
private JToggleButton toggleButton2;
private JLabel label12;
private JCheckBox checkBox1;
private JCheckBox checkBox2;
private JLabel label13;
private JRadioButton radioButton1;
private JRadioButton radioButton2;
private JLabel label8;
private JMenu menu1;
private JMenu menu2;
private JLabel label4;
private JMenuItem menuItem1;
private JMenuItem menuItem2;
private JLabel label9;
private JCheckBoxMenuItem checkBoxMenuItem1;
private JCheckBoxMenuItem checkBoxMenuItem2;
private JLabel label10;
private JRadioButtonMenuItem radioButtonMenuItem1;
private JRadioButtonMenuItem radioButtonMenuItem2;
private JLabel label1;
private JScrollPane scrollPane15;
private JEditorPane editorPane1;

View File

@@ -1,11 +1,11 @@
JFDML JFormDesigner: "7.0.1.0.272" Java: "13.0.2" encoding: "UTF-8"
JFDML JFormDesigner: "7.0.2.0.298" Java: "14" encoding: "UTF-8"
new FormModel {
contentType: "form/swing"
root: new FormRoot {
add( new FormContainer( "com.formdev.flatlaf.testing.FlatTestPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) {
"$layoutConstraints": "ltr,insets dialog,hidemode 3"
"$columnConstraints": "[fill][fill][fill][fill]"
"$columnConstraints": "[fill][fill][fill][fill][fill]"
"$rowConstraints": "[][top][top]"
} ) {
name: "this"
@@ -33,6 +33,183 @@ new FormModel {
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 3 0"
} )
add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) {
"$layoutConstraints": "insets 0,hidemode 3"
"$columnConstraints": "[fill][fill][fill]"
"$rowConstraints": "[][][][][][][][][]"
} ) {
name: "panel1"
add( new FormComponent( "javax.swing.JLabel" ) {
name: "label5"
"text": "JLabel:"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 0 0"
} )
add( new FormComponent( "javax.swing.JLabel" ) {
name: "label6"
"text": "<html>Some <b>Bold</b> Text"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 0"
} )
add( new FormComponent( "javax.swing.JLabel" ) {
name: "label7"
"text": "Some text"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 2 0"
} )
add( new FormComponent( "javax.swing.JLabel" ) {
name: "label3"
"text": "JButon:"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 0 1"
} )
add( new FormComponent( "javax.swing.JButton" ) {
name: "button1"
"text": "<html>Some <b>Bold</b> Text"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 1"
} )
add( new FormComponent( "javax.swing.JButton" ) {
name: "button2"
"text": "Some text"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 2 1"
} )
add( new FormComponent( "javax.swing.JLabel" ) {
name: "label11"
"text": "text"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 0 2"
} )
add( new FormComponent( "javax.swing.JToggleButton" ) {
name: "toggleButton1"
"text": "<html>Some <b>Bold</b> Text"
"selected": true
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 2"
} )
add( new FormComponent( "javax.swing.JToggleButton" ) {
name: "toggleButton2"
"text": "Some text"
"selected": true
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 2 2"
} )
add( new FormComponent( "javax.swing.JLabel" ) {
name: "label12"
"text": "text"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 0 3"
} )
add( new FormComponent( "javax.swing.JCheckBox" ) {
name: "checkBox1"
"text": "<html>Some <b>Bold</b> Text"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 3"
} )
add( new FormComponent( "javax.swing.JCheckBox" ) {
name: "checkBox2"
"text": "Some text"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 2 3"
} )
add( new FormComponent( "javax.swing.JLabel" ) {
name: "label13"
"text": "text"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 0 4"
} )
add( new FormComponent( "javax.swing.JRadioButton" ) {
name: "radioButton1"
"text": "<html>Some <b>Bold</b> Text"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 4"
} )
add( new FormComponent( "javax.swing.JRadioButton" ) {
name: "radioButton2"
"text": "Some text"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 2 4"
} )
add( new FormComponent( "javax.swing.JLabel" ) {
name: "label8"
"text": "JMenu:"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 0 5"
} )
add( new FormContainer( "javax.swing.JMenu", new FormLayoutManager( class javax.swing.JMenu ) ) {
name: "menu1"
"text": "<html>Some <b>Bold</b> Text"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 5"
} )
add( new FormContainer( "javax.swing.JMenu", new FormLayoutManager( class javax.swing.JMenu ) ) {
name: "menu2"
"text": "Some text"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 2 5"
} )
add( new FormComponent( "javax.swing.JLabel" ) {
name: "label4"
"text": "JMenuItem:"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 0 6"
} )
add( new FormComponent( "javax.swing.JMenuItem" ) {
name: "menuItem1"
"text": "<html>Some <b>Bold</b> Text"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 6"
} )
add( new FormComponent( "javax.swing.JMenuItem" ) {
name: "menuItem2"
"text": "Some text"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 2 6"
} )
add( new FormComponent( "javax.swing.JLabel" ) {
name: "label9"
"text": "JCheckBoxMenuItem:"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 0 7"
} )
add( new FormComponent( "javax.swing.JCheckBoxMenuItem" ) {
name: "checkBoxMenuItem1"
"text": "<html>Some <b>Bold</b> Text"
"selected": true
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 7"
} )
add( new FormComponent( "javax.swing.JCheckBoxMenuItem" ) {
name: "checkBoxMenuItem2"
"text": "Some text"
"selected": true
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 2 7"
} )
add( new FormComponent( "javax.swing.JLabel" ) {
name: "label10"
"text": "JRadioButtonMenuItem:"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 0 8"
} )
add( new FormComponent( "javax.swing.JRadioButtonMenuItem" ) {
name: "radioButtonMenuItem1"
"text": "<html>Some <b>Bold</b> Text"
"selected": true
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 8"
} )
add( new FormComponent( "javax.swing.JRadioButtonMenuItem" ) {
name: "radioButtonMenuItem2"
"text": "Some text"
"selected": true
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 2 8"
} )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 4 0 1 3,aligny top,growy 0"
} )
add( new FormComponent( "javax.swing.JLabel" ) {
name: "label1"
"text": "<html>HTML<br>Sample <b>content</b><br> <u>text</u> with <a href=\"#\">link</a><h1>Header 1</h1><h2>Header 2</h2><h3>Header 3</h3><h4>Header 4</h4><h5>Header 5</h5><h6>Header 6</h6><p>Paragraph</p><hr><table border=\"1\"><tr><th>Col 1</th><th>Col 2</th></tr><tr><td>abc</td><td>def</td></tr></table><ul><li>item 1</li><li>item 2</li></ul></html>"

View File

@@ -1,470 +0,0 @@
/*
* Copyright 2019 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
*
* http://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.AWTEvent;
import java.awt.Color;
import java.awt.Component;
import java.awt.Container;
import java.awt.Dimension;
import java.awt.EventQueue;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Insets;
import java.awt.KeyboardFocusManager;
import java.awt.LayoutManager;
import java.awt.MouseInfo;
import java.awt.Point;
import java.awt.Rectangle;
import java.awt.Toolkit;
import java.awt.Window;
import java.awt.event.AWTEventListener;
import java.awt.event.InputEvent;
import java.awt.event.KeyEvent;
import java.awt.event.MouseEvent;
import java.awt.event.MouseMotionAdapter;
import java.awt.event.MouseMotionListener;
import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
import java.lang.reflect.Field;
import javax.swing.AbstractButton;
import javax.swing.JComponent;
import javax.swing.JMenuBar;
import javax.swing.JRootPane;
import javax.swing.JToolBar;
import javax.swing.JToolTip;
import javax.swing.KeyStroke;
import javax.swing.RootPaneContainer;
import javax.swing.SwingUtilities;
import javax.swing.border.Border;
import javax.swing.border.EmptyBorder;
import javax.swing.border.LineBorder;
import javax.swing.plaf.UIResource;
import javax.swing.text.JTextComponent;
import com.formdev.flatlaf.ui.FlatToolTipUI;
import com.formdev.flatlaf.ui.FlatUIUtils;
import com.formdev.flatlaf.util.UIScale;
/**
* @author Karl Tauber
*/
public class FlatInspector
{
private static final Integer HIGHLIGHT_LAYER = 401;
private static final Integer TOOLTIP_LAYER = 402;
private static final int KEY_MODIFIERS_MASK = InputEvent.CTRL_DOWN_MASK | InputEvent.SHIFT_DOWN_MASK | InputEvent.ALT_DOWN_MASK | InputEvent.META_DOWN_MASK;
private final JRootPane rootPane;
private final MouseMotionListener mouseMotionListener;
private final AWTEventListener keyListener;
private final PropertyChangeSupport propertyChangeSupport = new PropertyChangeSupport( this );
private boolean enabled;
private Component lastComponent;
private int lastX;
private int lastY;
private int inspectParentLevel;
private JComponent highlightFigure;
private JToolTip tip;
/**
* Installs a key listener into the application that allows enabling and disabling
* the UI inspector with the given keystroke (e.g. "ctrl shift alt X").
*/
public static void install( String activationKeys ) {
KeyStroke keyStroke = KeyStroke.getKeyStroke( activationKeys );
Toolkit.getDefaultToolkit().addAWTEventListener( e -> {
if( e.getID() == KeyEvent.KEY_RELEASED &&
((KeyEvent)e).getKeyCode() == keyStroke.getKeyCode() &&
(((KeyEvent)e).getModifiersEx() & KEY_MODIFIERS_MASK) == (keyStroke.getModifiers() & KEY_MODIFIERS_MASK) )
{
Window activeWindow = KeyboardFocusManager.getCurrentKeyboardFocusManager().getActiveWindow();
if( activeWindow instanceof RootPaneContainer ) {
JRootPane rootPane = ((RootPaneContainer)activeWindow).getRootPane();
FlatInspector inspector = (FlatInspector) rootPane.getClientProperty( FlatInspector.class );
if( inspector == null ) {
inspector = new FlatInspector( rootPane );
rootPane.putClientProperty( FlatInspector.class, inspector );
inspector.setEnabled( true );
} else {
inspector.uninstall();
rootPane.putClientProperty( FlatInspector.class, null );
}
}
}
}, AWTEvent.KEY_EVENT_MASK );
}
public FlatInspector( JRootPane rootPane ) {
this.rootPane = rootPane;
mouseMotionListener = new MouseMotionAdapter() {
@Override
public void mouseMoved( MouseEvent e ) {
lastX = e.getX();
lastY = e.getY();
inspect( lastX, lastY );
}
};
rootPane.getGlassPane().addMouseMotionListener( mouseMotionListener );
keyListener = e -> {
KeyEvent keyEvent = (KeyEvent) e;
int keyCode = keyEvent.getKeyCode();
if( e.getID() == KeyEvent.KEY_RELEASED ) {
if( keyCode == KeyEvent.VK_CONTROL ) {
inspectParentLevel++;
inspect( lastX, lastY );
} else if( keyCode == KeyEvent.VK_SHIFT && inspectParentLevel > 0 ) {
inspectParentLevel--;
inspect( lastX, lastY );
}
}
if( keyCode == KeyEvent.VK_ESCAPE ) {
// consume pressed and released ESC key events to e.g. avoid that dialog is closed
keyEvent.consume();
if( e.getID() == KeyEvent.KEY_PRESSED ) {
FlatInspector inspector = (FlatInspector) rootPane.getClientProperty( FlatInspector.class );
if( inspector == FlatInspector.this ) {
uninstall();
rootPane.putClientProperty( FlatInspector.class, null );
} else
setEnabled( false );
}
}
};
}
private void uninstall() {
setEnabled( false );
rootPane.getGlassPane().setVisible( false );
rootPane.getGlassPane().removeMouseMotionListener( mouseMotionListener );
}
public void addPropertyChangeListener( PropertyChangeListener l ) {
propertyChangeSupport.addPropertyChangeListener( l );
}
public void removePropertyChangeListener( PropertyChangeListener l ) {
propertyChangeSupport.removePropertyChangeListener( l );
}
public boolean isEnabled() {
return enabled;
}
public void setEnabled( boolean enabled ) {
if( this.enabled == enabled )
return;
this.enabled = enabled;
rootPane.getGlassPane().setVisible( enabled );
Toolkit toolkit = Toolkit.getDefaultToolkit();
if( enabled )
toolkit.addAWTEventListener( keyListener, AWTEvent.KEY_EVENT_MASK );
else
toolkit.removeAWTEventListener( keyListener );
if( enabled ) {
Point pt = new Point( MouseInfo.getPointerInfo().getLocation() );
SwingUtilities.convertPointFromScreen( pt, rootPane );
lastX = pt.x;
lastY = pt.y;
inspect( lastX, lastY );
} else {
lastComponent = null;
inspectParentLevel = 0;
if( highlightFigure != null )
highlightFigure.getParent().remove( highlightFigure );
highlightFigure = null;
if( tip != null )
tip.getParent().remove( tip );
tip = null;
}
propertyChangeSupport.firePropertyChange( "enabled", !enabled, enabled );
}
public void update() {
if( !rootPane.getGlassPane().isVisible() )
return;
EventQueue.invokeLater( () -> {
setEnabled( false );
setEnabled( true );
inspect( lastX, lastY );
} );
}
private void inspect( int x, int y ) {
Point pt = SwingUtilities.convertPoint( rootPane.getGlassPane(), x, y, rootPane );
Component c = getDeepestComponentAt( rootPane, pt.x, pt.y );
for( int i = 0; i < inspectParentLevel && c != null; i++ ) {
Container parent = c.getParent();
if( parent == null )
break;
c = parent;
}
if( c == lastComponent )
return;
lastComponent = c;
highlight( c );
showToolTip( c, x, y );
}
private Component getDeepestComponentAt( Component parent, int x, int y ) {
if( !parent.contains( x, y ) )
return null;
if( parent instanceof Container ) {
for( Component child : ((Container)parent).getComponents() ) {
if( child == null || !child.isVisible() )
continue;
int cx = x - child.getX();
int cy = y - child.getY();
Component c = (child instanceof Container)
? getDeepestComponentAt( child, cx, cy )
: child.getComponentAt( cx, cy );
if( c == null || !c.isVisible() )
continue;
// ignore highlight figure and tooltip
if( c == highlightFigure || c == tip )
continue;
// ignore glass pane
if( c.getParent() instanceof JRootPane && c == ((JRootPane)c.getParent()).getGlassPane() )
continue;
if( "com.formdev.flatlaf.ui.FlatWindowResizer".equals( c.getClass().getName() ) )
continue;
return c;
}
}
return parent;
}
private void highlight( Component c ) {
if( highlightFigure == null ) {
highlightFigure = createHighlightFigure();
rootPane.getLayeredPane().add( highlightFigure, HIGHLIGHT_LAYER );
}
highlightFigure.setVisible( c != null );
if( c != null ) {
Insets insets = rootPane.getInsets();
highlightFigure.setBounds( new Rectangle(
SwingUtilities.convertPoint( c, -insets.left, -insets.top, rootPane ),
c.getSize() ) );
}
}
private JComponent createHighlightFigure() {
JComponent c = new JComponent() {
@Override
protected void paintComponent( Graphics g ) {
g.setColor( getBackground() );
g.fillRect( 0, 0, getWidth(), getHeight() );
}
@Override
protected void paintBorder( Graphics g ) {
FlatUIUtils.setRenderingHints( (Graphics2D) g );
super.paintBorder( g );
}
};
c.setBackground( new Color( 255, 0, 0, 32 ) );
c.setBorder( new LineBorder( Color.red ) );
return c;
}
private void showToolTip( Component c, int x, int y ) {
if( c == null ) {
if( tip != null )
tip.setVisible( false );
return;
}
if( tip == null ) {
tip = new JToolTip() {
@Override
public void updateUI() {
setUI( FlatToolTipUI.createUI( this ) );
}
};
rootPane.getLayeredPane().add( tip, TOOLTIP_LAYER );
} else
tip.setVisible( true );
tip.setTipText( buildToolTipText( c ) );
int tx = x + UIScale.scale( 8 );
int ty = y + UIScale.scale( 16 );
Dimension size = tip.getPreferredSize();
// position the tip in the visible area
Rectangle visibleRect = rootPane.getVisibleRect();
if( tx + size.width > visibleRect.x + visibleRect.width )
tx -= size.width + UIScale.scale( 16 );
if( ty + size.height > visibleRect.y + visibleRect.height )
ty -= size.height + UIScale.scale( 32 );
if( tx < visibleRect.x )
tx = visibleRect.x;
if( ty < visibleRect.y )
ty = visibleRect.y;
tip.setBounds( tx, ty, size.width, size.height );
tip.repaint();
}
private String buildToolTipText( Component c ) {
String name = c.getClass().getName();
name = name.substring( name.lastIndexOf( '.' ) + 1 );
String text =
"Class: " + name + " (" + c.getClass().getPackage().getName() + ")\n" +
"Size: " + c.getWidth() + ',' + c.getHeight() + " @ " + c.getX() + ',' + c.getY() + '\n';
if( c instanceof Container )
text += "Insets: " + toString( ((Container)c).getInsets() ) + '\n';
Insets margin = null;
if( c instanceof AbstractButton )
margin = ((AbstractButton) c).getMargin();
else if( c instanceof JTextComponent )
margin = ((JTextComponent) c).getMargin();
else if( c instanceof JMenuBar )
margin = ((JMenuBar) c).getMargin();
else if( c instanceof JToolBar )
margin = ((JToolBar) c).getMargin();
if( margin != null )
text += "Margin: " + toString( margin ) + '\n';
Dimension prefSize = c.getPreferredSize();
Dimension minSize = c.getMinimumSize();
Dimension maxSize = c.getMaximumSize();
text += "Pref size: " + prefSize.width + ',' + prefSize.height + '\n' +
"Min size: " + minSize.width + ',' + minSize.height + '\n' +
"Max size: " + maxSize.width + ',' + maxSize.height + '\n';
if( c instanceof JComponent )
text += "Border: " + toString( ((JComponent)c).getBorder() ) + '\n';
text += "Background: " + toString( c.getBackground() ) + '\n' +
"Foreground: " + toString( c.getForeground() ) + '\n' +
"Font: " + toString( c.getFont() ) + '\n';
if( c instanceof JComponent ) {
try {
Field f = JComponent.class.getDeclaredField( "ui" );
f.setAccessible( true );
Object ui = f.get( c );
text += "UI: " + (ui != null ? ui.getClass().getName() : "null") + '\n';
} catch( NoSuchFieldException | SecurityException | IllegalArgumentException | IllegalAccessException ex ) {
// ignore
}
}
if( c instanceof Container ) {
LayoutManager layout = ((Container)c).getLayout();
if( layout != null )
text += "Layout: " + layout.getClass().getName() + '\n';
}
text += "Enabled: " + c.isEnabled() + '\n';
text += "Opaque: " + c.isOpaque() + (c instanceof JComponent &&
FlatUIUtils.hasOpaqueBeenExplicitlySet( (JComponent) c ) ? " EXPLICIT" : "") + '\n';
if( c instanceof AbstractButton )
text += "ContentAreaFilled: " + ((AbstractButton)c).isContentAreaFilled() + '\n';
text += "Focusable: " + c.isFocusable() + '\n';
text += "Left-to-right: " + c.getComponentOrientation().isLeftToRight() + '\n';
text += "Parent: " + (c.getParent() != null ? c.getParent().getClass().getName() : "null");
if( inspectParentLevel > 0 )
text += "\n\nParent level: " + inspectParentLevel;
if( inspectParentLevel > 0 )
text += "\n(press Ctrl/Shift to increase/decrease level)";
else
text += "\n\n(press Ctrl key to inspect parent)";
return text;
}
private static String toString( Insets insets ) {
if( insets == null )
return "null";
return insets.top + "," + insets.left + ',' + insets.bottom + ',' + insets.right
+ (insets instanceof UIResource ? " UI" : "");
}
private static String toString( Color c ) {
if( c == null )
return "null";
String s = Long.toString( c.getRGB() & 0xffffffffl, 16 );
if( c instanceof UIResource )
s += " UI";
return s;
}
private static String toString( Font f ) {
if( f == null )
return "null";
return f.getFamily() + " " + f.getSize() + " " + f.getStyle()
+ (f instanceof UIResource ? " UI" : "");
}
private static String toString( Border b ) {
if( b == null )
return "null";
String s = b.getClass().getName();
if( b instanceof EmptyBorder )
s += '(' + toString( ((EmptyBorder)b).getBorderInsets() ) + ')';
if( b instanceof UIResource )
s += " UI";
return s;
}
}

View File

@@ -0,0 +1,249 @@
/*
* Copyright 2020 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.Dimension;
import java.awt.Font;
import java.awt.FontMetrics;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Insets;
import java.awt.geom.AffineTransform;
import javax.swing.*;
import javax.swing.border.EmptyBorder;
import com.formdev.flatlaf.ui.FlatUIUtils;
import com.formdev.flatlaf.util.Graphics2DProxy;
import com.formdev.flatlaf.util.HiDPIUtils;
import com.formdev.flatlaf.util.JavaCompatibility;
import com.formdev.flatlaf.util.SystemInfo;
import net.miginfocom.swing.*;
/**
* @author Karl Tauber
*/
public class FlatPaintingStringTest
extends JPanel
{
public static void main( String[] args ) {
System.setProperty( "flatlaf.uiScale", "1x" );
System.setProperty( "sun.java2d.uiScale", "1x" );
SwingUtilities.invokeLater( () -> {
FlatTestFrame frame = FlatTestFrame.create( args, "FlatPaintingStringTest" );
ToolTipManager.sharedInstance().setInitialDelay( 0 );
ToolTipManager.sharedInstance().setDismissDelay( 10000 );
frame.showFrame( FlatPaintingStringTest::new );
} );
}
FlatPaintingStringTest() {
initComponents();
add( new JLabel() );
add( new JLabel( "none" ) );
add( new JLabel( "flatlaf" ) );
add( new JLabel( "0.25*scale" ) );
add( new JLabel( "0.5*scale" ) );
if( SystemInfo.IS_JAVA_9_OR_LATER ) {
add( new JLabel( "0.25" ) );
add( new JLabel( "0.5" ) );
add( new JLabel( "0.625" ) );
add( new JLabel( "0.75" ) );
add( new JLabel( "0.875" ) );
} else {
add( new JLabel( "0.625*scale" ) );
add( new JLabel( "0.75*scale" ) );
add( new JLabel( "0.875*scale" ) );
}
YCorrectionFunction none = (g, scaleFactor) -> 0;
YCorrectionFunction flatlaf = (g, scaleFactor) -> {
return SystemInfo.IS_JAVA_9_OR_LATER
? HiDPIUtils.computeTextYCorrection( g )
: (scaleFactor > 1 ? -(0.625f * scaleFactor) : 0);
};
YCorrectionFunction oneQSysScale = (g, scaleFactor) -> -(0.25f * scaleFactor);
YCorrectionFunction halfSysScale = (g, scaleFactor) -> -(0.5f * scaleFactor);
YCorrectionFunction fiveEightsQSysScale = (g, scaleFactor) -> -(0.625f * scaleFactor);
YCorrectionFunction threeQSysScale = (g, scaleFactor) -> -(0.75f * scaleFactor);
YCorrectionFunction sevenEightsSysScale = (g, scaleFactor) -> -(0.875f * scaleFactor);
YCorrectionFunction oneQ = (g, scaleFactor) -> -0.25f;
YCorrectionFunction half = (g, scaleFactor) -> -0.5f;
YCorrectionFunction fiveEights = (g, scaleFactor) -> -0.625f;
YCorrectionFunction threeQ = (g, scaleFactor) -> -0.75f;
YCorrectionFunction sevenEights = (g, scaleFactor) -> -0.875f;
float[] scaleFactors = new float[] { 1f, 1.25f, 1.5f, 1.75f, 2f, 2.25f, 2.5f, 3f, 3.5f, 4f };
for( float scaleFactor : scaleFactors ) {
add( new JLabel( String.valueOf( scaleFactor ) ), "newLine" );
add( scaleFactor, none );
add( scaleFactor, flatlaf );
add( scaleFactor, oneQSysScale );
add( scaleFactor, halfSysScale );
if( SystemInfo.IS_JAVA_9_OR_LATER ) {
add( scaleFactor, oneQ );
add( scaleFactor, half );
add( scaleFactor, fiveEights );
add( scaleFactor, threeQ );
add( scaleFactor, sevenEights );
} else {
add( scaleFactor, fiveEightsQSysScale );
add( scaleFactor, threeQSysScale );
add( scaleFactor, sevenEightsSysScale );
}
}
}
private void add( float scaleFactor, YCorrectionFunction correctionFunction ) {
if( SystemInfo.IS_JAVA_9_OR_LATER ) {
add( new Painter( scaleFactor, correctionFunction, 0 ), "split 4, gapx 0 0" );
add( new Painter( scaleFactor, correctionFunction, 0.25f ), "gapx 0 0" );
add( new Painter( scaleFactor, correctionFunction, 0.5f ), "gapx 0 0" );
add( new Painter( scaleFactor, correctionFunction, 0.75f ), "gapx 0 0" );
} else
add( new Painter( scaleFactor, correctionFunction, 0 ) );
}
private void initComponents() {
// JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents
//======== this ========
setBorder(null);
setLayout(new MigLayout(
"insets dialog,hidemode 3",
// columns
"[fill]",
// rows
"[top]"));
// 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
private interface YCorrectionFunction {
float computeTextYCorrection( Graphics2D g, float scaleFactor );
}
//---- class Painter ------------------------------------------------------
public static class Painter
extends JLabel
{
private final float scaleFactor;
private final YCorrectionFunction correctionFunction;
private final float yOffset;
public Painter( float scaleFactor, YCorrectionFunction correctionFunction, float yOffset ) {
super( "E" );
this.scaleFactor = scaleFactor;
this.correctionFunction = correctionFunction;
this.yOffset = yOffset;
setBorder( new EmptyBorder( 2, 0, 2, 0 ) );
if( !SystemInfo.IS_JAVA_9_OR_LATER ) {
Font font = getFont();
setFont( font.deriveFont( (float) Math.round( font.getSize() * scaleFactor ) ) );
}
}
@Override
public Dimension getPreferredSize() {
Dimension size = super.getPreferredSize();
Insets insets = getInsets();
int leftRight = insets.left + insets.right;
return new Dimension(
scale( size.width -leftRight ) + leftRight,
scale( size.height ) );
}
@Override
protected void paintComponent( Graphics g ) {
Graphics2D g2 = (Graphics2D) g;
FlatUIUtils.setRenderingHints( g2 );
// simulate component y position at a fraction
if( scaleFactor > 1 && SystemInfo.IS_JAVA_9_OR_LATER )
g2.translate( 0, yOffset );
int width = getWidth();
int height = getHeight();
Insets insets = getInsets();
FontMetrics fm = getFontMetrics( getFont() );
// paint lines at 1x
HiDPIUtils.paintAtScale1x( g2, 0, 0, width, height,
(g2d, x2, y2, width2, height2, scaleFactor2) -> {
// g.setColor( Color.blue );
// g.drawLine( 0, 0, width2, 0 );
// g.drawLine( 0, height2 - 1, width2, height2 - 1 );
int baseline = (int) Math.round( (insets.top + fm.getAscent()) * scaleFactor2
* (SystemInfo.IS_JAVA_9_OR_LATER ? scaleFactor : 1f) ) - 1;
int topline = height2 - baseline - 1;
g.setColor( Color.red );
g.drawLine( 0, baseline, width2, baseline );
g.drawLine( 0, topline, width2, topline );
} );
// move x before scaling to have same left inset at all scale factors
g.translate( insets.left, 0 );
// scale
if( SystemInfo.IS_JAVA_9_OR_LATER )
((Graphics2D)g).scale( scaleFactor, scaleFactor );
// compute Y correction
float yCorrection = correctionFunction.computeTextYCorrection( g2, scaleFactor );
// create graphics that applies Y correction
Graphics2D cg = new Graphics2DProxy( g2 ) {
@Override
public void drawString( String str, int x, int y ) {
super.drawString( str, x, y + yCorrection );
}
@Override
public void drawString( String str, float x, float y ) {
super.drawString( str, x, y + yCorrection );
}
};
// draw string
g.setColor( getForeground() );
int y = insets.top + fm.getAscent();
JavaCompatibility.drawStringUnderlineCharAt( this, cg, "E", -1, 0, y );
// set tooltip text
if( getToolTipText() == null ) {
AffineTransform t = g2.getTransform();
double textY = t.getTranslateY() + (y * t.getScaleY());
setToolTipText( textY + " + " + yCorrection + " = " + (textY + yCorrection) );
}
}
private int scale( int value ) {
return SystemInfo.IS_JAVA_9_OR_LATER ? Math.round( value * scaleFactor ) : value;
}
}
}

View File

@@ -0,0 +1,21 @@
JFDML JFormDesigner: "7.0.2.0.298" Java: "14" 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": "[fill]"
"$rowConstraints": "[top]"
} ) {
name: "this"
"border": sfield com.jformdesigner.model.FormObject NULL_VALUE
}, new FormLayoutConstraints( null ) {
"location": new java.awt.Point( 0, 0 )
"size": new java.awt.Dimension( 450, 300 )
} )
}
}

View File

@@ -287,7 +287,7 @@ public class FlatTestFrame
if( menuBarFactory != null )
setJMenuBar( menuBarFactory.apply( content ) );
contentPanel.getContentPane().add( content );
contentPanel.add( content );
pack();
setLocationRelativeTo( null );
setVisible( true );
@@ -589,9 +589,9 @@ public class FlatTestFrame
}
private void recreateContent() {
contentPanel.getContentPane().remove( content );
contentPanel.remove( content );
content = contentFactory.get();
contentPanel.getContentPane().add( content );
contentPanel.add( content );
if( rightToLeftCheckBox.isSelected() )
rightToLeftChanged();
@@ -607,7 +607,7 @@ public class FlatTestFrame
private void initComponents() {
// JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents
dialogPane = new JPanel();
contentPanel = new JRootPane();
contentPanel = new JPanel();
buttonBar = new JPanel();
lookAndFeelComboBox = new LookAndFeelsComboBox();
scaleFactorComboBox = new JComboBox<>();
@@ -633,8 +633,7 @@ public class FlatTestFrame
//======== contentPanel ========
{
Container contentPanelContentPane = contentPanel.getContentPane();
contentPanelContentPane.setLayout(new MigLayout(
contentPanel.setLayout(new MigLayout(
"insets 0,hidemode 3",
// columns
"[grow,fill]",
@@ -753,7 +752,7 @@ public class FlatTestFrame
// JFormDesigner - Variables declaration - DO NOT MODIFY //GEN-BEGIN:variables
private JPanel dialogPane;
private JRootPane contentPanel;
private JPanel contentPanel;
private JPanel buttonBar;
private LookAndFeelsComboBox lookAndFeelComboBox;
private JComboBox<String> scaleFactorComboBox;

View File

@@ -1,4 +1,4 @@
JFDML JFormDesigner: "7.0.1.0.272" Java: "13.0.2" encoding: "UTF-8"
JFDML JFormDesigner: "7.0.2.0.298" Java: "13.0.2" encoding: "UTF-8"
new FormModel {
contentType: "form/swing"
@@ -10,7 +10,7 @@ new FormModel {
"defaultCloseOperation": 2
add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class java.awt.BorderLayout ) ) {
name: "dialogPane"
add( new FormContainer( "javax.swing.JRootPane", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) {
add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) {
"$layoutConstraints": "insets 0,hidemode 3"
"$columnConstraints": "[grow,fill]"
"$rowConstraints": "[grow,fill]"

View File

@@ -0,0 +1,157 @@
/*
* Copyright 2019 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
*
* http://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.glazedlists;
import java.util.Comparator;
import javax.swing.*;
import com.formdev.flatlaf.testing.*;
import com.formdev.flatlaf.testing.FlatTestFrame;
import ca.odell.glazedlists.BasicEventList;
import ca.odell.glazedlists.EventList;
import ca.odell.glazedlists.SortedList;
import ca.odell.glazedlists.gui.TableFormat;
import ca.odell.glazedlists.swing.AdvancedTableModel;
import ca.odell.glazedlists.swing.GlazedListsSwing;
import ca.odell.glazedlists.swing.TableComparatorChooser;
import net.miginfocom.swing.*;
/**
* @author Karl Tauber
*/
public class FlatGlazedListsTest
extends FlatTestPanel
{
public static void main( String[] args ) {
SwingUtilities.invokeLater( () -> {
FlatTestFrame frame = FlatTestFrame.create( args, "FlatGlazedListsTest" );
frame.showFrame( FlatGlazedListsTest::new );
} );
}
FlatGlazedListsTest() {
initComponents();
EventList<Item> itemEventList = new BasicEventList<>();
itemEventList.add( new Item( "item 1", "item 1b", "January", 123, null ) );
itemEventList.add( new Item( "item 2", "item 2b", "February", 456, true ) );
itemEventList.add( new Item( "item 3", null, "March", null, false ) );
itemEventList.add( new Item( "item 4", null, "April", 234, true ) );
itemEventList.add( new Item( "item 5", null, "May", null, false ) );
itemEventList.add( new Item( "item 6", null, "June", null, null ) );
itemEventList.add( new Item( "item 7", null, "July", null, null ) );
itemEventList.add( new Item( "item 8", null, "August", null, null ) );
itemEventList.add( new Item( "item 9", null, "September", null, null ) );
itemEventList.add( new Item( "item 10", null, "October", null, null ) );
itemEventList.add( new Item( "item 11", null, "November", null, null ) );
itemEventList.add( new Item( "item 12", null, "December", null, null ) );
Comparator<Item> itemComparator = Comparator.comparing( Item::getName );
SortedList<Item> sortedItems = new SortedList<>( itemEventList, itemComparator );
AdvancedTableModel<Item> tableModel = GlazedListsSwing.eventTableModelWithThreadProxyList( sortedItems, new ItemTableFormat() );
itemsTable.setModel( tableModel );
TableComparatorChooser<Item> tableComparatorChooser = TableComparatorChooser.install(
itemsTable, sortedItems, TableComparatorChooser.MULTIPLE_COLUMN_MOUSE );
tableComparatorChooser.appendComparator( 0, 0, false );
TableComparatorChooser.setIconPath( "resources/windowsxp" );
}
private void initComponents() {
// JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents
scrollPane1 = new JScrollPane();
itemsTable = new JTable();
//======== this ========
setLayout(new MigLayout(
"insets dialog,hidemode 3",
// columns
"[grow,fill]",
// rows
"[grow,fill]"));
//======== scrollPane1 ========
{
scrollPane1.setViewportView(itemsTable);
}
add(scrollPane1, "cell 0 0,growx,width 300");
// JFormDesigner - End of component initialization //GEN-END:initComponents
}
// JFormDesigner - Variables declaration - DO NOT MODIFY //GEN-BEGIN:variables
private JScrollPane scrollPane1;
private JTable itemsTable;
// JFormDesigner - End of variables declaration //GEN-END:variables
//---- class Item ---------------------------------------------------------
private static class Item
{
final String name;
final String desc;
final String month;
final Integer number;
final Boolean bool;
Item( String name, String desc, String month, Integer number, Boolean bool ) {
this.name = name;
this.desc = desc;
this.month = month;
this.number = number;
this.bool = bool;
}
String getName() {
return name;
}
}
//---- class ItemTableFormat ----------------------------------------------
private static class ItemTableFormat
implements TableFormat<Item>
{
private static String[] COLUMN_NAMES = {
"Name",
"Description",
"Month",
"Integer",
"Boolean",
};
@Override
public int getColumnCount() {
return COLUMN_NAMES.length;
}
@Override
public String getColumnName( int column ) {
return COLUMN_NAMES[column];
}
@Override
public Object getColumnValue( Item item, int column ) {
switch( column ) {
case 0: return item.name;
case 1: return item.desc;
case 2: return item.month;
case 3: return item.number;
case 4: return item.bool;
}
throw new IllegalStateException();
}
}
}

View File

@@ -0,0 +1,34 @@
JFDML JFormDesigner: "7.0.2.0.298" Java: "13.0.2" 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": "insets dialog,hidemode 3"
"$columnConstraints": "[grow,fill]"
"$rowConstraints": "[grow,fill]"
} ) {
name: "this"
add( new FormContainer( "javax.swing.JScrollPane", new FormLayoutManager( class javax.swing.JScrollPane ) ) {
name: "scrollPane1"
auxiliary() {
"JavaCodeGenerator.variableLocal": false
}
add( new FormComponent( "javax.swing.JTable" ) {
name: "itemsTable"
auxiliary() {
"JavaCodeGenerator.variableLocal": false
}
} )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 0 0,growx,width 300"
} )
}, new FormLayoutConstraints( null ) {
"location": new java.awt.Point( 0, 0 )
"size": new java.awt.Dimension( 500, 500 )
} )
}
}

View File

@@ -36,6 +36,8 @@ import java.util.LinkedHashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Objects;
import java.util.TreeSet;
import java.util.function.Predicate;
import javax.swing.Icon;
import javax.swing.ImageIcon;
@@ -89,9 +91,11 @@ public class UIDefaultsDump
dump( FlatLightLaf.class.getName(), dir );
dump( FlatDarkLaf.class.getName(), dir );
// dump( FlatIntelliJLaf.class.getName(), dir );
// dump( FlatDarculaLaf.class.getName(), dir );
//
if( SystemInfo.IS_WINDOWS ) {
dump( FlatIntelliJLaf.class.getName(), dir );
dump( FlatDarculaLaf.class.getName(), dir );
}
// dump( MyBasicLookAndFeel.class.getName(), dir );
// dump( MetalLookAndFeel.class.getName(), dir );
// dump( NimbusLookAndFeel.class.getName(), dir );
@@ -170,14 +174,20 @@ public class UIDefaultsDump
: ((SystemInfo.IS_LINUX && lookAndFeel instanceof FlatLaf)
? "-linux"
: "");
String javaVersion = System.getProperty( "java.version" );
File file = new File( dir, name + nameSuffix + "_"
+ System.getProperty( "java.version" ) + osSuffix + ".txt" );
+ javaVersion + osSuffix + ".txt" );
// build differences
String content;
if( !osSuffix.isEmpty() && nameSuffix.isEmpty() ) {
File origFile = new File( dir, name + nameSuffix + "_"
+ System.getProperty( "java.version" ) + ".txt" );
File origFile = null;
if( !osSuffix.isEmpty() && nameSuffix.isEmpty() )
origFile = new File( dir, name + nameSuffix + "_" + javaVersion + ".txt" );
else if( lookAndFeel instanceof FlatIntelliJLaf && SystemInfo.IS_WINDOWS )
origFile = new File( dir, "FlatLightLaf_" + javaVersion + ".txt" );
else if( lookAndFeel instanceof FlatDarculaLaf && SystemInfo.IS_WINDOWS )
origFile = new File( dir, "FlatDarkLaf_" + javaVersion + ".txt" );
if( origFile != null ) {
try {
Map<String, String> defaults1 = parse( new FileReader( origFile ) );
Map<String, String> defaults2 = parse( new StringReader( stringWriter.toString() ) );
@@ -200,29 +210,33 @@ public class UIDefaultsDump
}
private static String diff( Map<String, String> defaults1, Map<String, String> defaults2 ) {
defaults1 = new LinkedHashMap<>( defaults1 );
TreeSet<String> keys = new TreeSet<>();
keys.addAll( defaults1.keySet() );
keys.addAll( defaults2.keySet() );
StringBuilder buf = new StringBuilder( 10000 );
for( Map.Entry<String, String> e : defaults2.entrySet() ) {
String key = e.getKey();
String value2 = e.getValue();
String value1 = defaults1.remove( key );
if( !value2.equals( value1 ) ) {
if( value1 != null )
buf.append( "- " ).append( key ).append( value1 ).append( '\n' );
buf.append( "+ " ).append( key ).append( value2 ).append( '\n' );
buf.append( '\n' );
}
}
for( Map.Entry<String, String> e : defaults1.entrySet() ) {
buf.append( "- " ).append( e.getKey() ).append( e.getValue() ).append( '\n' );
buf.append( '\n' );
}
// diff header values
for( String key : new String[] { "Class", "ID", "Name", "Java", "OS" } )
diffValue( buf, key, defaults1.remove( key ), defaults2.remove( key ) );
// diff values
for( String key : keys )
diffValue( buf, key, defaults1.get( key ), defaults2.get( key ) );
return buf.toString();
}
private static void diffValue( StringBuilder buf, String key, String value1, String value2 ) {
if( !Objects.equals( value1, value2 ) ) {
if( value1 != null )
buf.append( "- " ).append( key ).append( value1 ).append( '\n' );
if( value2 != null )
buf.append( "+ " ).append( key ).append( value2 ).append( '\n' );
buf.append( '\n' );
}
}
private static Map<String, String> parse( Reader in ) throws IOException {
Map<String, String> defaults = new LinkedHashMap<>();
try( BufferedReader reader = new BufferedReader( in ) ) {