mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2025-12-07 22:40:53 +03:00
Testing: added "background" checkbox to test apps
This commit is contained in:
@@ -23,7 +23,7 @@ import net.miginfocom.swing.*;
|
||||
* @author Karl Tauber
|
||||
*/
|
||||
public class FlatChooserTest
|
||||
extends JPanel
|
||||
extends FlatTestPanel
|
||||
{
|
||||
public static void main( String[] args ) {
|
||||
SwingUtilities.invokeLater( () -> {
|
||||
|
||||
@@ -6,7 +6,7 @@ new FormModel {
|
||||
auxiliary() {
|
||||
"JavaCodeGenerator.defaultVariableLocal": true
|
||||
}
|
||||
add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) {
|
||||
add( new FormContainer( "com.formdev.flatlaf.testing.FlatTestPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) {
|
||||
"$layoutConstraints": "insets 0,hidemode 3,gap 5 5,ltr"
|
||||
"$columnConstraints": "[][]"
|
||||
"$rowConstraints": "[top][top][]"
|
||||
|
||||
@@ -24,7 +24,7 @@ import net.miginfocom.swing.*;
|
||||
* @author Karl Tauber
|
||||
*/
|
||||
public class FlatComponents2Test
|
||||
extends JPanel
|
||||
extends FlatTestPanel
|
||||
{
|
||||
public static void main( String[] args ) {
|
||||
SwingUtilities.invokeLater( () -> {
|
||||
|
||||
@@ -6,7 +6,7 @@ new FormModel {
|
||||
auxiliary() {
|
||||
"JavaCodeGenerator.defaultVariableLocal": true
|
||||
}
|
||||
add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) {
|
||||
add( new FormContainer( "com.formdev.flatlaf.testing.FlatTestPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) {
|
||||
"$layoutConstraints": "insets 0,hidemode 3,gap 5 5,ltr"
|
||||
"$columnConstraints": "[][200][200]"
|
||||
"$rowConstraints": "[][][][::200][::150]"
|
||||
|
||||
@@ -25,7 +25,7 @@ import net.miginfocom.swing.*;
|
||||
* @author Karl Tauber
|
||||
*/
|
||||
public class FlatComponentsTest
|
||||
extends JPanel
|
||||
extends FlatTestPanel
|
||||
{
|
||||
public static void main( String[] args ) {
|
||||
SwingUtilities.invokeLater( () -> {
|
||||
@@ -758,6 +758,7 @@ public class FlatComponentsTest
|
||||
|
||||
//======== panel3 ========
|
||||
{
|
||||
panel3.setOpaque(false);
|
||||
panel3.setLayout(new MigLayout(
|
||||
"insets 0,hidemode 3,gap 5 5,ltr",
|
||||
// columns
|
||||
@@ -801,6 +802,7 @@ public class FlatComponentsTest
|
||||
//======== panel2 ========
|
||||
{
|
||||
panel2.setBorder(new TitledBorder("TitledBorder"));
|
||||
panel2.setOpaque(false);
|
||||
panel2.setLayout(new FlowLayout());
|
||||
}
|
||||
add(panel2, "cell 3 16,grow");
|
||||
|
||||
@@ -6,7 +6,7 @@ new FormModel {
|
||||
auxiliary() {
|
||||
"JavaCodeGenerator.defaultVariableLocal": true
|
||||
}
|
||||
add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) {
|
||||
add( new FormContainer( "com.formdev.flatlaf.testing.FlatTestPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) {
|
||||
"$layoutConstraints": "insets 0,hidemode 3,gap 5 5,ltr"
|
||||
"$columnConstraints": "[][][][][][]"
|
||||
"$rowConstraints": "[][][][][][][][][][][][][][][][][][][][][][]"
|
||||
@@ -56,7 +56,7 @@ new FormModel {
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 2 1"
|
||||
} )
|
||||
add( new FormComponent( "com.formdev.flatlaf.FlatComponentsTest$TestDefaultButton" ) {
|
||||
add( new FormComponent( "com.formdev.flatlaf.testing.FlatComponentsTest$TestDefaultButton" ) {
|
||||
name: "button5"
|
||||
"text": "default"
|
||||
"displayedMnemonicIndex": 0
|
||||
@@ -716,6 +716,7 @@ new FormModel {
|
||||
"$layoutConstraints": "insets 0,hidemode 3,gap 5 5,ltr"
|
||||
} ) {
|
||||
name: "panel3"
|
||||
"opaque": false
|
||||
add( new FormComponent( "javax.swing.JLabel" ) {
|
||||
name: "label3"
|
||||
"text": "<html>JLabel HTML<br>Sample <b>content</b><br> <u>text</u></html>"
|
||||
@@ -759,6 +760,7 @@ new FormModel {
|
||||
add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class java.awt.FlowLayout ) ) {
|
||||
name: "panel2"
|
||||
"border": new javax.swing.border.TitledBorder( "TitledBorder" )
|
||||
"opaque": false
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 3 16,grow"
|
||||
} )
|
||||
|
||||
@@ -14,7 +14,7 @@ import net.miginfocom.swing.*;
|
||||
* @author Karl Tauber
|
||||
*/
|
||||
public class FlatContainerTest
|
||||
extends JPanel
|
||||
extends FlatTestPanel
|
||||
{
|
||||
public static void main( String[] args ) {
|
||||
SwingUtilities.invokeLater( () -> {
|
||||
@@ -112,6 +112,7 @@ public class FlatContainerTest
|
||||
|
||||
//======== panel9 ========
|
||||
{
|
||||
panel9.setOpaque(false);
|
||||
panel9.setLayout(new FormLayout(
|
||||
"70dlu:grow, $lcgap, 70dlu:grow",
|
||||
"default, $lgap, fill:70dlu, $lgap, pref, 2*($lgap, fill:70dlu:grow), $lgap, pref"));
|
||||
@@ -283,6 +284,7 @@ public class FlatContainerTest
|
||||
|
||||
//======== panel14 ========
|
||||
{
|
||||
panel14.setOpaque(false);
|
||||
panel14.setLayout(new MigLayout(
|
||||
"insets 0,hidemode 3",
|
||||
// columns
|
||||
|
||||
@@ -6,7 +6,7 @@ new FormModel {
|
||||
auxiliary() {
|
||||
"JavaCodeGenerator.defaultVariableLocal": true
|
||||
}
|
||||
add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) {
|
||||
add( new FormContainer( "com.formdev.flatlaf.testing.FlatTestPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) {
|
||||
"$layoutConstraints": "insets 0,hidemode 3"
|
||||
"$columnConstraints": "[grow,fill]"
|
||||
"$rowConstraints": "[grow,fill]"
|
||||
@@ -17,6 +17,7 @@ new FormModel {
|
||||
"$rowSpecs": "default, linegap, fill:70dlu, linegap, pref, linegap, fill:70dlu:grow, linegap, fill:70dlu:grow, linegap, pref"
|
||||
} ) {
|
||||
name: "panel9"
|
||||
"opaque": false
|
||||
add( new FormComponent( "javax.swing.JLabel" ) {
|
||||
name: "splitPaneLabel"
|
||||
"text": "JSplitPane:"
|
||||
@@ -203,6 +204,7 @@ new FormModel {
|
||||
"$rowConstraints": "[center]"
|
||||
} ) {
|
||||
name: "panel14"
|
||||
"opaque": false
|
||||
add( new FormComponent( "javax.swing.JCheckBox" ) {
|
||||
name: "moreTabsCheckBox"
|
||||
"text": "more tabs"
|
||||
|
||||
@@ -26,7 +26,7 @@ import net.miginfocom.swing.*;
|
||||
* @author Karl Tauber
|
||||
*/
|
||||
public class FlatMenusTest
|
||||
extends JPanel
|
||||
extends FlatTestPanel
|
||||
{
|
||||
public static void main( String[] args ) {
|
||||
SwingUtilities.invokeLater( () -> {
|
||||
@@ -155,6 +155,7 @@ public class FlatMenusTest
|
||||
|
||||
//======== panel1 ========
|
||||
{
|
||||
panel1.setOpaque(false);
|
||||
panel1.setLayout(new MigLayout(
|
||||
"insets 0,hidemode 3,gap 5 5,ltr",
|
||||
// columns
|
||||
@@ -213,6 +214,7 @@ public class FlatMenusTest
|
||||
|
||||
//======== panel2 ========
|
||||
{
|
||||
panel2.setOpaque(false);
|
||||
panel2.setLayout(new MigLayout(
|
||||
"insets 0,gap 5 5",
|
||||
// columns
|
||||
@@ -253,6 +255,7 @@ public class FlatMenusTest
|
||||
|
||||
//======== panel3 ========
|
||||
{
|
||||
panel3.setOpaque(false);
|
||||
panel3.setLayout(new MigLayout(
|
||||
"insets 0,gap 5 5",
|
||||
// columns
|
||||
@@ -292,6 +295,7 @@ public class FlatMenusTest
|
||||
|
||||
//======== panel4 ========
|
||||
{
|
||||
panel4.setOpaque(false);
|
||||
panel4.setLayout(new MigLayout(
|
||||
"insets 0,gap 5 5",
|
||||
// columns
|
||||
|
||||
@@ -6,7 +6,7 @@ new FormModel {
|
||||
auxiliary() {
|
||||
"JavaCodeGenerator.defaultVariableLocal": true
|
||||
}
|
||||
add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) {
|
||||
add( new FormContainer( "com.formdev.flatlaf.testing.FlatTestPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) {
|
||||
"$layoutConstraints": "insets 0,hidemode 3,gap 5 5,ltr"
|
||||
"$columnConstraints": "[125][][][][]"
|
||||
"$rowConstraints": "[][top][][]"
|
||||
@@ -53,6 +53,7 @@ new FormModel {
|
||||
"$layoutConstraints": "insets 0,hidemode 3,gap 5 5,ltr"
|
||||
} ) {
|
||||
name: "panel1"
|
||||
"opaque": false
|
||||
add( new FormComponent( "javax.swing.JLabel" ) {
|
||||
name: "menuLabel"
|
||||
"text": "JMenu:"
|
||||
@@ -124,6 +125,7 @@ new FormModel {
|
||||
"$layoutConstraints": "insets 0,gap 5 5"
|
||||
} ) {
|
||||
name: "panel2"
|
||||
"opaque": false
|
||||
add( new FormContainer( "javax.swing.JMenu", new FormLayoutManager( class javax.swing.JMenu ) ) {
|
||||
name: "menu2"
|
||||
"text": "disabled"
|
||||
@@ -164,6 +166,7 @@ new FormModel {
|
||||
"$layoutConstraints": "insets 0,gap 5 5"
|
||||
} ) {
|
||||
name: "panel3"
|
||||
"opaque": false
|
||||
add( new FormContainer( "javax.swing.JMenu", new FormLayoutManager( class javax.swing.JMenu ) ) {
|
||||
name: "menu3"
|
||||
"text": "text"
|
||||
@@ -204,6 +207,7 @@ new FormModel {
|
||||
"$layoutConstraints": "insets 0,gap 5 5"
|
||||
} ) {
|
||||
name: "panel4"
|
||||
"opaque": false
|
||||
add( new FormContainer( "javax.swing.JMenu", new FormLayoutManager( class javax.swing.JMenu ) ) {
|
||||
name: "menu4"
|
||||
"text": "text"
|
||||
|
||||
@@ -27,7 +27,7 @@ import net.miginfocom.swing.*;
|
||||
* @author Karl Tauber
|
||||
*/
|
||||
public class FlatOptionPaneTest
|
||||
extends JPanel
|
||||
extends FlatTestPanel
|
||||
{
|
||||
public static void main( String[] args ) {
|
||||
SwingUtilities.invokeLater( () -> {
|
||||
|
||||
@@ -6,7 +6,7 @@ new FormModel {
|
||||
auxiliary() {
|
||||
"JavaCodeGenerator.defaultVariableLocal": true
|
||||
}
|
||||
add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) {
|
||||
add( new FormContainer( "com.formdev.flatlaf.testing.FlatTestPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) {
|
||||
"$layoutConstraints": "flowy,ltr,insets 0,hidemode 3,gap 5 5"
|
||||
"$columnConstraints": "[][][fill]"
|
||||
"$rowConstraints": "[top][top][top][top][top][top][top][top]"
|
||||
@@ -30,7 +30,7 @@ new FormModel {
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 1 0"
|
||||
} )
|
||||
add( new FormComponent( "com.formdev.flatlaf.FlatOptionPaneTest$ShowDialogLinkLabel" ) {
|
||||
add( new FormComponent( "com.formdev.flatlaf.testing.FlatOptionPaneTest$ShowDialogLinkLabel" ) {
|
||||
name: "plainShowDialogLabel"
|
||||
"optionPane": new FormReference( "plainOptionPane" )
|
||||
"titleLabel": new FormReference( "plainLabel" )
|
||||
@@ -60,7 +60,7 @@ new FormModel {
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 1 1"
|
||||
} )
|
||||
add( new FormComponent( "com.formdev.flatlaf.FlatOptionPaneTest$ShowDialogLinkLabel" ) {
|
||||
add( new FormComponent( "com.formdev.flatlaf.testing.FlatOptionPaneTest$ShowDialogLinkLabel" ) {
|
||||
name: "errorShowDialogLabel"
|
||||
"titleLabel": new FormReference( "errorLabel" )
|
||||
"optionPane": new FormReference( "errorOptionPane" )
|
||||
@@ -90,7 +90,7 @@ new FormModel {
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 1 2"
|
||||
} )
|
||||
add( new FormComponent( "com.formdev.flatlaf.FlatOptionPaneTest$ShowDialogLinkLabel" ) {
|
||||
add( new FormComponent( "com.formdev.flatlaf.testing.FlatOptionPaneTest$ShowDialogLinkLabel" ) {
|
||||
name: "informationShowDialogLabel"
|
||||
"optionPane": new FormReference( "informationOptionPane" )
|
||||
"titleLabel": new FormReference( "informationLabel" )
|
||||
@@ -120,7 +120,7 @@ new FormModel {
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 1 3"
|
||||
} )
|
||||
add( new FormComponent( "com.formdev.flatlaf.FlatOptionPaneTest$ShowDialogLinkLabel" ) {
|
||||
add( new FormComponent( "com.formdev.flatlaf.testing.FlatOptionPaneTest$ShowDialogLinkLabel" ) {
|
||||
name: "questionShowDialogLabel"
|
||||
"optionPane": new FormReference( "questionOptionPane" )
|
||||
"titleLabel": new FormReference( "questionLabel" )
|
||||
@@ -147,7 +147,7 @@ new FormModel {
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 1 4"
|
||||
} )
|
||||
add( new FormComponent( "com.formdev.flatlaf.FlatOptionPaneTest$ShowDialogLinkLabel" ) {
|
||||
add( new FormComponent( "com.formdev.flatlaf.testing.FlatOptionPaneTest$ShowDialogLinkLabel" ) {
|
||||
name: "warningShowDialogLabel"
|
||||
"optionPane": new FormReference( "warningOptionPane" )
|
||||
"titleLabel": new FormReference( "warningLabel" )
|
||||
@@ -174,7 +174,7 @@ new FormModel {
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 1 5"
|
||||
} )
|
||||
add( new FormComponent( "com.formdev.flatlaf.FlatOptionPaneTest$ShowDialogLinkLabel" ) {
|
||||
add( new FormComponent( "com.formdev.flatlaf.testing.FlatOptionPaneTest$ShowDialogLinkLabel" ) {
|
||||
name: "inputShowDialogLabel"
|
||||
"optionPane": new FormReference( "inputOptionPane" )
|
||||
"titleLabel": new FormReference( "inputLabel" )
|
||||
@@ -202,7 +202,7 @@ new FormModel {
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 1 6"
|
||||
} )
|
||||
add( new FormComponent( "com.formdev.flatlaf.FlatOptionPaneTest$ShowDialogLinkLabel" ) {
|
||||
add( new FormComponent( "com.formdev.flatlaf.testing.FlatOptionPaneTest$ShowDialogLinkLabel" ) {
|
||||
name: "inputIconShowDialogLabel"
|
||||
"titleLabel": new FormReference( "inputIconLabel" )
|
||||
"optionPane": new FormReference( "inputIconOptionPane" )
|
||||
@@ -230,7 +230,7 @@ new FormModel {
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 1 7"
|
||||
} )
|
||||
add( new FormComponent( "com.formdev.flatlaf.FlatOptionPaneTest$ShowDialogLinkLabel" ) {
|
||||
add( new FormComponent( "com.formdev.flatlaf.testing.FlatOptionPaneTest$ShowDialogLinkLabel" ) {
|
||||
name: "customShowDialogLabel"
|
||||
"optionPane": new FormReference( "customOptionPane" )
|
||||
"titleLabel": new FormReference( "customLabel" )
|
||||
|
||||
@@ -313,6 +313,14 @@ public class FlatTestFrame
|
||||
} );
|
||||
}
|
||||
|
||||
private void backgroundChanged() {
|
||||
contentPanel.repaint();
|
||||
}
|
||||
|
||||
boolean isPaintBackgroundPattern() {
|
||||
return backgroundCheckBox.isSelected();
|
||||
}
|
||||
|
||||
private void rightToLeftChanged() {
|
||||
ComponentOrientation orientation = rightToLeftCheckBox.isSelected()
|
||||
? ComponentOrientation.RIGHT_TO_LEFT
|
||||
@@ -401,11 +409,12 @@ public class FlatTestFrame
|
||||
contentPanel = new JRootPane();
|
||||
buttonBar = new JPanel();
|
||||
lookAndFeelComboBox = new JComboBox<>();
|
||||
explicitColorsCheckBox = new JCheckBox();
|
||||
scaleFactorComboBox = new JComboBox<>();
|
||||
rightToLeftCheckBox = new JCheckBox();
|
||||
enabledCheckBox = new JCheckBox();
|
||||
inspectCheckBox = new JCheckBox();
|
||||
scaleFactorComboBox = new JComboBox<>();
|
||||
explicitColorsCheckBox = new JCheckBox();
|
||||
backgroundCheckBox = new JCheckBox();
|
||||
closeButton = new JButton();
|
||||
|
||||
//======== this ========
|
||||
@@ -440,6 +449,7 @@ public class FlatTestFrame
|
||||
"[fill]" +
|
||||
"[fill]" +
|
||||
"[fill]" +
|
||||
"[fill]" +
|
||||
"[grow,fill]" +
|
||||
"[button,fill]",
|
||||
// rows
|
||||
@@ -449,11 +459,23 @@ public class FlatTestFrame
|
||||
lookAndFeelComboBox.addActionListener(e -> lookAndFeelChanged());
|
||||
buttonBar.add(lookAndFeelComboBox, "cell 0 0");
|
||||
|
||||
//---- explicitColorsCheckBox ----
|
||||
explicitColorsCheckBox.setText("explicit colors");
|
||||
explicitColorsCheckBox.setMnemonic('X');
|
||||
explicitColorsCheckBox.addActionListener(e -> explicitColorsChanged());
|
||||
buttonBar.add(explicitColorsCheckBox, "cell 1 0");
|
||||
//---- scaleFactorComboBox ----
|
||||
scaleFactorComboBox.setModel(new DefaultComboBoxModel<>(new String[] {
|
||||
"default",
|
||||
"1",
|
||||
"1.25",
|
||||
"1.5",
|
||||
"1.75",
|
||||
"2.0",
|
||||
"2.25",
|
||||
"2.5",
|
||||
"3",
|
||||
"3.5",
|
||||
"4"
|
||||
}));
|
||||
scaleFactorComboBox.setMaximumRowCount(20);
|
||||
scaleFactorComboBox.addActionListener(e -> scaleFactorChanged());
|
||||
buttonBar.add(scaleFactorComboBox, "cell 1 0");
|
||||
|
||||
//---- rightToLeftCheckBox ----
|
||||
rightToLeftCheckBox.setText("right-to-left");
|
||||
@@ -474,27 +496,21 @@ public class FlatTestFrame
|
||||
inspectCheckBox.addActionListener(e -> inspectChanged());
|
||||
buttonBar.add(inspectCheckBox, "cell 4 0");
|
||||
|
||||
//---- scaleFactorComboBox ----
|
||||
scaleFactorComboBox.setModel(new DefaultComboBoxModel<>(new String[] {
|
||||
"default",
|
||||
"1",
|
||||
"1.25",
|
||||
"1.5",
|
||||
"1.75",
|
||||
"2.0",
|
||||
"2.25",
|
||||
"2.5",
|
||||
"3",
|
||||
"3.5",
|
||||
"4"
|
||||
}));
|
||||
scaleFactorComboBox.setMaximumRowCount(20);
|
||||
scaleFactorComboBox.addActionListener(e -> scaleFactorChanged());
|
||||
buttonBar.add(scaleFactorComboBox, "cell 5 0");
|
||||
//---- explicitColorsCheckBox ----
|
||||
explicitColorsCheckBox.setText("explicit colors");
|
||||
explicitColorsCheckBox.setMnemonic('X');
|
||||
explicitColorsCheckBox.addActionListener(e -> explicitColorsChanged());
|
||||
buttonBar.add(explicitColorsCheckBox, "cell 5 0");
|
||||
|
||||
//---- backgroundCheckBox ----
|
||||
backgroundCheckBox.setText("background");
|
||||
backgroundCheckBox.setMnemonic('B');
|
||||
backgroundCheckBox.addActionListener(e -> backgroundChanged());
|
||||
buttonBar.add(backgroundCheckBox, "cell 6 0");
|
||||
|
||||
//---- closeButton ----
|
||||
closeButton.setText("Close");
|
||||
buttonBar.add(closeButton, "cell 7 0");
|
||||
buttonBar.add(closeButton, "cell 8 0");
|
||||
}
|
||||
dialogPane.add(buttonBar, BorderLayout.SOUTH);
|
||||
}
|
||||
@@ -507,11 +523,12 @@ public class FlatTestFrame
|
||||
private JRootPane contentPanel;
|
||||
private JPanel buttonBar;
|
||||
private JComboBox<LafInfo> lookAndFeelComboBox;
|
||||
private JCheckBox explicitColorsCheckBox;
|
||||
private JComboBox<String> scaleFactorComboBox;
|
||||
private JCheckBox rightToLeftCheckBox;
|
||||
private JCheckBox enabledCheckBox;
|
||||
private JCheckBox inspectCheckBox;
|
||||
private JComboBox<String> scaleFactorComboBox;
|
||||
private JCheckBox explicitColorsCheckBox;
|
||||
private JCheckBox backgroundCheckBox;
|
||||
private JButton closeButton;
|
||||
// JFormDesigner - End of variables declaration //GEN-END:variables
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ new FormModel {
|
||||
} )
|
||||
add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) {
|
||||
"$layoutConstraints": "insets dialog"
|
||||
"$columnConstraints": "[fill][fill][fill][fill][fill][fill][grow,fill][button,fill]"
|
||||
"$columnConstraints": "[fill][fill][fill][fill][fill][fill][fill][grow,fill][button,fill]"
|
||||
"$rowSpecs": "[fill]"
|
||||
} ) {
|
||||
name: "buttonBar"
|
||||
@@ -34,11 +34,27 @@ new FormModel {
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 0 0"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JCheckBox" ) {
|
||||
name: "explicitColorsCheckBox"
|
||||
"text": "explicit colors"
|
||||
"mnemonic": 88
|
||||
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "explicitColorsChanged", false ) )
|
||||
add( new FormComponent( "javax.swing.JComboBox" ) {
|
||||
name: "scaleFactorComboBox"
|
||||
"model": new javax.swing.DefaultComboBoxModel {
|
||||
selectedItem: "default"
|
||||
addElement( "default" )
|
||||
addElement( "1" )
|
||||
addElement( "1.25" )
|
||||
addElement( "1.5" )
|
||||
addElement( "1.75" )
|
||||
addElement( "2.0" )
|
||||
addElement( "2.25" )
|
||||
addElement( "2.5" )
|
||||
addElement( "3" )
|
||||
addElement( "3.5" )
|
||||
addElement( "4" )
|
||||
}
|
||||
"maximumRowCount": 20
|
||||
auxiliary() {
|
||||
"JavaCodeGenerator.typeParameters": "String"
|
||||
}
|
||||
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "scaleFactorChanged", false ) )
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 1 0"
|
||||
} )
|
||||
@@ -67,35 +83,27 @@ new FormModel {
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 4 0"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JComboBox" ) {
|
||||
name: "scaleFactorComboBox"
|
||||
"model": new javax.swing.DefaultComboBoxModel {
|
||||
selectedItem: "default"
|
||||
addElement( "default" )
|
||||
addElement( "1" )
|
||||
addElement( "1.25" )
|
||||
addElement( "1.5" )
|
||||
addElement( "1.75" )
|
||||
addElement( "2.0" )
|
||||
addElement( "2.25" )
|
||||
addElement( "2.5" )
|
||||
addElement( "3" )
|
||||
addElement( "3.5" )
|
||||
addElement( "4" )
|
||||
}
|
||||
"maximumRowCount": 20
|
||||
auxiliary() {
|
||||
"JavaCodeGenerator.typeParameters": "String"
|
||||
}
|
||||
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "scaleFactorChanged", false ) )
|
||||
add( new FormComponent( "javax.swing.JCheckBox" ) {
|
||||
name: "explicitColorsCheckBox"
|
||||
"text": "explicit colors"
|
||||
"mnemonic": 88
|
||||
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "explicitColorsChanged", false ) )
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 5 0"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JCheckBox" ) {
|
||||
name: "backgroundCheckBox"
|
||||
"text": "background"
|
||||
"mnemonic": 66
|
||||
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "backgroundChanged", false ) )
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 6 0"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JButton" ) {
|
||||
name: "closeButton"
|
||||
"text": "Close"
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 7 0"
|
||||
"value": "cell 8 0"
|
||||
} )
|
||||
}, new FormLayoutConstraints( class java.lang.String ) {
|
||||
"value": "South"
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
* 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.Color;
|
||||
import java.awt.Graphics;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.SwingUtilities;
|
||||
|
||||
/**
|
||||
* @author Karl Tauber
|
||||
*/
|
||||
public class FlatTestPanel
|
||||
extends JPanel
|
||||
{
|
||||
@Override
|
||||
protected void paintComponent( Graphics g ) {
|
||||
super.paintComponent( g );
|
||||
|
||||
FlatTestFrame frame = (FlatTestFrame) SwingUtilities.getAncestorOfClass( FlatTestFrame.class, this );
|
||||
if( frame != null && frame.isPaintBackgroundPattern() ) {
|
||||
g.setColor( Color.magenta );
|
||||
int width = getWidth();
|
||||
int height = getHeight();
|
||||
for( int y = 0; y < height; y += 2 )
|
||||
g.drawLine( 0, y, width - 1, y );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -23,12 +23,13 @@ import javax.swing.*;
|
||||
import net.miginfocom.swing.*;
|
||||
import org.jdesktop.swingx.*;
|
||||
import com.formdev.flatlaf.testing.FlatTestFrame;
|
||||
import com.formdev.flatlaf.testing.FlatTestPanel;
|
||||
|
||||
/**
|
||||
* @author Karl Tauber
|
||||
*/
|
||||
public class FlatSwingXTest
|
||||
extends JPanel
|
||||
extends FlatTestPanel
|
||||
{
|
||||
public static void main( String[] args ) {
|
||||
SwingUtilities.invokeLater( () -> {
|
||||
@@ -199,7 +200,7 @@ public class FlatSwingXTest
|
||||
|
||||
//---- busyCheckBox ----
|
||||
busyCheckBox.setText("busy");
|
||||
busyCheckBox.setMnemonic('B');
|
||||
busyCheckBox.setMnemonic('Y');
|
||||
busyCheckBox.addActionListener(e -> busyChanged());
|
||||
add(busyCheckBox, "cell 2 6");
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ new FormModel {
|
||||
auxiliary() {
|
||||
"JavaCodeGenerator.defaultVariableLocal": true
|
||||
}
|
||||
add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) {
|
||||
add( new FormContainer( "com.formdev.flatlaf.testing.FlatTestPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) {
|
||||
"$layoutConstraints": "hidemode 3,ltr"
|
||||
"$columnConstraints": "[left][][][fill]"
|
||||
"$rowConstraints": "[]0[][]0[][][][][]"
|
||||
@@ -144,7 +144,7 @@ new FormModel {
|
||||
add( new FormComponent( "javax.swing.JCheckBox" ) {
|
||||
name: "busyCheckBox"
|
||||
"text": "busy"
|
||||
"mnemonic": 66
|
||||
"mnemonic": 89
|
||||
auxiliary() {
|
||||
"JavaCodeGenerator.variableLocal": false
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user