From a16db38a6f72592b7aedc0abd772d493a4090605 Mon Sep 17 00:00:00 2001 From: Karl Tauber Date: Wed, 18 Nov 2020 18:32:08 +0100 Subject: [PATCH] Testing: FlatBaselineTest added --- .../flatlaf/testing/FlatBaselineTest.java | 328 +++++++++++++++++ .../flatlaf/testing/FlatBaselineTest.jfd | 331 ++++++++++++++++++ 2 files changed, 659 insertions(+) create mode 100644 flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatBaselineTest.java create mode 100644 flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatBaselineTest.jfd diff --git a/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatBaselineTest.java b/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatBaselineTest.java new file mode 100644 index 00000000..22a4851c --- /dev/null +++ b/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatBaselineTest.java @@ -0,0 +1,328 @@ +/* + * 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 javax.swing.*; +import javax.swing.table.*; +import javax.swing.tree.*; +import net.miginfocom.swing.*; + +/** + * @author Karl Tauber + */ +public class FlatBaselineTest + extends FlatTestPanel +{ + public static void main( String[] args ) { + SwingUtilities.invokeLater( () -> { + FlatTestFrame frame = FlatTestFrame.create( args, "FlatBaselineTest" ); + frame.showFrame( FlatBaselineTest::new ); + } ); + } + + public FlatBaselineTest() { + initComponents(); + } + + private void initComponents() { + // JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents + JLabel label1 = new JLabel(); + JButton button1 = new JButton(); + JToggleButton toggleButton1 = new JToggleButton(); + JCheckBox checkBox1 = new JCheckBox(); + JRadioButton radioButton1 = new JRadioButton(); + JTextField textField4 = new JTextField(); + JLabel label2 = new JLabel(); + JTextField textField1 = new JTextField(); + JFormattedTextField formattedTextField1 = new JFormattedTextField(); + JPasswordField passwordField1 = new JPasswordField(); + JComboBox comboBox1 = new JComboBox<>(); + JSpinner spinner1 = new JSpinner(); + JLabel label6 = new JLabel(); + JScrollPane scrollPane1 = new JScrollPane(); + JTextArea textArea1 = new JTextArea(); + JTextArea textArea2 = new JTextArea(); + JTextField textField2 = new JTextField(); + JLabel label7 = new JLabel(); + JScrollPane scrollPane3 = new JScrollPane(); + JList list1 = new JList<>(); + JScrollPane scrollPane4 = new JScrollPane(); + JTree tree1 = new JTree(); + JScrollPane scrollPane5 = new JScrollPane(); + JTable table1 = new JTable(); + JTextField textField3 = new JTextField(); + JLabel label3 = new JLabel(); + JSlider slider1 = new JSlider(); + JSlider slider6 = new JSlider(); + JLabel label8 = new JLabel(); + JSlider slider7 = new JSlider(); + JSlider slider8 = new JSlider(); + JLabel label4 = new JLabel(); + JProgressBar progressBar1 = new JProgressBar(); + JProgressBar progressBar3 = new JProgressBar(); + JSeparator separator1 = new JSeparator(); + JLabel label5 = new JLabel(); + JSlider slider2 = new JSlider(); + JSlider slider3 = new JSlider(); + JProgressBar progressBar2 = new JProgressBar(); + JProgressBar progressBar4 = new JProgressBar(); + JPanel hSpacer1 = new JPanel(null); + JLabel label9 = new JLabel(); + JSlider slider4 = new JSlider(); + JSlider slider5 = new JSlider(); + JPanel hSpacer2 = new JPanel(null); + + //======== this ======== + setLayout(new MigLayout( + "insets dialog,hidemode 3,debug", + // columns + "[fill]" + + "[fill]" + + "[fill]" + + "[fill]" + + "[fill]" + + "[fill]" + + "[fill]", + // rows + "[]" + + "[]" + + "[50]" + + "[::80]" + + "[]" + + "[]" + + "[]" + + "[]" + + "[]")); + + //---- label1 ---- + label1.setText("Dext"); + add(label1, "cell 0 0"); + + //---- button1 ---- + button1.setText("Dext"); + add(button1, "cell 1 0"); + + //---- toggleButton1 ---- + toggleButton1.setText("Dext"); + add(toggleButton1, "cell 2 0"); + + //---- checkBox1 ---- + checkBox1.setText("Dext"); + add(checkBox1, "cell 3 0"); + + //---- radioButton1 ---- + radioButton1.setText("Dext"); + add(radioButton1, "cell 4 0"); + + //---- textField4 ---- + textField4.setText("Dext field"); + add(textField4, "cell 6 0"); + + //---- label2 ---- + label2.setText("Dext"); + add(label2, "cell 0 1"); + + //---- textField1 ---- + textField1.setText("Dext"); + add(textField1, "cell 1 1"); + + //---- formattedTextField1 ---- + formattedTextField1.setText("Dext"); + add(formattedTextField1, "cell 2 1"); + + //---- passwordField1 ---- + passwordField1.setText("Dext"); + add(passwordField1, "cell 3 1"); + add(comboBox1, "cell 4 1"); + add(spinner1, "cell 5 1"); + + //---- label6 ---- + label6.setText("Dext"); + add(label6, "cell 0 2"); + + //======== scrollPane1 ======== + { + + //---- textArea1 ---- + textArea1.setText("Dext"); + textArea1.setRows(4); + scrollPane1.setViewportView(textArea1); + } + add(scrollPane1, "cell 1 2"); + + //---- textArea2 ---- + textArea2.setText("Dext"); + textArea2.setRows(4); + add(textArea2, "cell 2 2"); + + //---- textField2 ---- + textField2.setText("Dext field"); + add(textField2, "cell 6 2"); + + //---- label7 ---- + label7.setText("Dext"); + add(label7, "cell 0 3"); + + //======== scrollPane3 ======== + { + + //---- list1 ---- + list1.setModel(new AbstractListModel() { + String[] values = { + "Dext", + "Dext", + "Dext" + }; + @Override + public int getSize() { return values.length; } + @Override + public String getElementAt(int i) { return values[i]; } + }); + scrollPane3.setViewportView(list1); + } + add(scrollPane3, "cell 1 3"); + + //======== scrollPane4 ======== + { + + //---- tree1 ---- + tree1.setModel(new DefaultTreeModel( + new DefaultMutableTreeNode("Dext") { + { + add(new DefaultMutableTreeNode("Dext")); + add(new DefaultMutableTreeNode("Dext")); + } + })); + scrollPane4.setViewportView(tree1); + } + add(scrollPane4, "cell 2 3"); + + //======== scrollPane5 ======== + { + + //---- table1 ---- + table1.setModel(new DefaultTableModel( + new Object[][] { + {"Dext", "0"}, + {"Dext ", "1"}, + }, + new String[] { + "Dext", null + } + )); + scrollPane5.setViewportView(table1); + } + add(scrollPane5, "cell 3 3,wmax 100"); + + //---- textField3 ---- + textField3.setText("Dext field"); + add(textField3, "cell 6 3"); + + //---- label3 ---- + label3.setText("Dext"); + add(label3, "cell 0 4"); + add(slider1, "cell 1 4 6 1"); + + //---- slider6 ---- + slider6.setPaintTicks(true); + slider6.setMajorTickSpacing(25); + slider6.setMinorTickSpacing(5); + add(slider6, "cell 1 4 6 1"); + + //---- label8 ---- + label8.setText("Dext"); + add(label8, "cell 0 5"); + + //---- slider7 ---- + slider7.setPaintLabels(true); + slider7.setMajorTickSpacing(25); + slider7.setMinorTickSpacing(5); + add(slider7, "cell 1 5 6 1"); + + //---- slider8 ---- + slider8.setPaintLabels(true); + slider8.setPaintTicks(true); + slider8.setMajorTickSpacing(25); + slider8.setMinorTickSpacing(5); + add(slider8, "cell 1 5 6 1"); + + //---- label4 ---- + label4.setText("Dext"); + add(label4, "cell 0 6"); + + //---- progressBar1 ---- + progressBar1.setValue(30); + add(progressBar1, "cell 1 6 6 1"); + + //---- progressBar3 ---- + progressBar3.setStringPainted(true); + progressBar3.setValue(30); + add(progressBar3, "cell 1 6 6 1"); + add(separator1, "cell 1 6 6 1"); + + //---- label5 ---- + label5.setText("Dext"); + add(label5, "cell 0 7"); + + //---- slider2 ---- + slider2.setOrientation(SwingConstants.VERTICAL); + add(slider2, "cell 1 7 6 1"); + + //---- slider3 ---- + slider3.setOrientation(SwingConstants.VERTICAL); + slider3.setPaintTicks(true); + slider3.setMajorTickSpacing(25); + slider3.setMinorTickSpacing(5); + add(slider3, "cell 1 7 6 1"); + + //---- progressBar2 ---- + progressBar2.setOrientation(SwingConstants.VERTICAL); + progressBar2.setValue(30); + add(progressBar2, "cell 1 7 6 1"); + + //---- progressBar4 ---- + progressBar4.setOrientation(SwingConstants.VERTICAL); + progressBar4.setStringPainted(true); + progressBar4.setValue(30); + add(progressBar4, "cell 1 7 6 1"); + add(hSpacer1, "cell 1 7 6 1,growx"); + + //---- label9 ---- + label9.setText("Dext"); + add(label9, "cell 0 8"); + + //---- slider4 ---- + slider4.setOrientation(SwingConstants.VERTICAL); + slider4.setPaintLabels(true); + slider4.setMajorTickSpacing(25); + slider4.setMinorTickSpacing(5); + add(slider4, "cell 1 8 6 1"); + + //---- slider5 ---- + slider5.setOrientation(SwingConstants.VERTICAL); + slider5.setPaintLabels(true); + slider5.setPaintTicks(true); + slider5.setMajorTickSpacing(25); + slider5.setMinorTickSpacing(5); + add(slider5, "cell 1 8 6 1"); + add(hSpacer2, "cell 1 8 6 1,growx"); + // 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 +} diff --git a/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatBaselineTest.jfd b/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatBaselineTest.jfd new file mode 100644 index 00000000..b41f8d16 --- /dev/null +++ b/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatBaselineTest.jfd @@ -0,0 +1,331 @@ +JFDML JFormDesigner: "7.0.2.0.298" Java: "15" 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,debug" + "$columnConstraints": "[fill][fill][fill][fill][fill][fill][fill]" + "$rowConstraints": "[][][50][::80][][][][][]" + } ) { + name: "this" + add( new FormComponent( "javax.swing.JLabel" ) { + name: "label1" + "text": "Dext" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 0 0" + } ) + add( new FormComponent( "javax.swing.JButton" ) { + name: "button1" + "text": "Dext" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 1 0" + } ) + add( new FormComponent( "javax.swing.JToggleButton" ) { + name: "toggleButton1" + "text": "Dext" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 2 0" + } ) + add( new FormComponent( "javax.swing.JCheckBox" ) { + name: "checkBox1" + "text": "Dext" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 3 0" + } ) + add( new FormComponent( "javax.swing.JRadioButton" ) { + name: "radioButton1" + "text": "Dext" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 4 0" + } ) + add( new FormComponent( "javax.swing.JTextField" ) { + name: "textField4" + "text": "Dext field" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 6 0" + } ) + add( new FormComponent( "javax.swing.JLabel" ) { + name: "label2" + "text": "Dext" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 0 1" + } ) + add( new FormComponent( "javax.swing.JTextField" ) { + name: "textField1" + "text": "Dext" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 1 1" + } ) + add( new FormComponent( "javax.swing.JFormattedTextField" ) { + name: "formattedTextField1" + "text": "Dext" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 2 1" + } ) + add( new FormComponent( "javax.swing.JPasswordField" ) { + name: "passwordField1" + "text": "Dext" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 3 1" + } ) + add( new FormComponent( "javax.swing.JComboBox" ) { + name: "comboBox1" + auxiliary() { + "JavaCodeGenerator.typeParameters": "String" + } + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 4 1" + } ) + add( new FormComponent( "javax.swing.JSpinner" ) { + name: "spinner1" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 5 1" + } ) + add( new FormComponent( "javax.swing.JLabel" ) { + name: "label6" + "text": "Dext" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 0 2" + } ) + add( new FormContainer( "javax.swing.JScrollPane", new FormLayoutManager( class javax.swing.JScrollPane ) ) { + name: "scrollPane1" + add( new FormComponent( "javax.swing.JTextArea" ) { + name: "textArea1" + "text": "Dext" + "rows": 4 + } ) + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 1 2" + } ) + add( new FormComponent( "javax.swing.JTextArea" ) { + name: "textArea2" + "text": "Dext" + "rows": 4 + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 2 2" + } ) + add( new FormComponent( "javax.swing.JTextField" ) { + name: "textField2" + "text": "Dext field" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 6 2" + } ) + add( new FormComponent( "javax.swing.JLabel" ) { + name: "label7" + "text": "Dext" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 0 3" + } ) + add( new FormContainer( "javax.swing.JScrollPane", new FormLayoutManager( class javax.swing.JScrollPane ) ) { + name: "scrollPane3" + add( new FormComponent( "javax.swing.JList" ) { + name: "list1" + "model": new javax.swing.DefaultListModel { + addElement( "Dext" ) + addElement( "Dext" ) + addElement( "Dext" ) + } + } ) + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 1 3" + } ) + add( new FormContainer( "javax.swing.JScrollPane", new FormLayoutManager( class javax.swing.JScrollPane ) ) { + name: "scrollPane4" + add( new FormComponent( "javax.swing.JTree" ) { + name: "tree1" + "model": new javax.swing.tree.DefaultTreeModel( new javax.swing.tree.DefaultMutableTreeNode { + userObject: "Dext" + add( new javax.swing.tree.DefaultMutableTreeNode { + userObject: "Dext" + } ) + add( new javax.swing.tree.DefaultMutableTreeNode { + userObject: "Dext" + } ) + } ) + } ) + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 2 3" + } ) + add( new FormContainer( "javax.swing.JScrollPane", new FormLayoutManager( class javax.swing.JScrollPane ) ) { + name: "scrollPane5" + add( new FormComponent( "javax.swing.JTable" ) { + name: "table1" + "model": new com.jformdesigner.model.SwingTableModel( new java.util.Vector { + add( new java.util.Vector { + add( "Dext" ) + add( "0" ) + } ) + add( new java.util.Vector { + add( "Dext " ) + add( "1" ) + } ) + }, new java.util.Vector { + add( "Dext" ) + add( null ) + }, new java.util.Vector { + add( null ) + add( null ) + }, new java.util.Vector { + add( null ) + add( null ) + }, new java.util.Vector { + add( null ) + add( null ) + } ) + } ) + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 3 3,wmax 100" + } ) + add( new FormComponent( "javax.swing.JTextField" ) { + name: "textField3" + "text": "Dext field" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 6 3" + } ) + add( new FormComponent( "javax.swing.JLabel" ) { + name: "label3" + "text": "Dext" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 0 4" + } ) + add( new FormComponent( "javax.swing.JSlider" ) { + name: "slider1" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 1 4 6 1" + } ) + add( new FormComponent( "javax.swing.JSlider" ) { + name: "slider6" + "paintTicks": true + "majorTickSpacing": 25 + "minorTickSpacing": 5 + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 1 4 6 1" + } ) + add( new FormComponent( "javax.swing.JLabel" ) { + name: "label8" + "text": "Dext" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 0 5" + } ) + add( new FormComponent( "javax.swing.JSlider" ) { + name: "slider7" + "paintLabels": true + "majorTickSpacing": 25 + "minorTickSpacing": 5 + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 1 5 6 1" + } ) + add( new FormComponent( "javax.swing.JSlider" ) { + name: "slider8" + "paintLabels": true + "paintTicks": true + "majorTickSpacing": 25 + "minorTickSpacing": 5 + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 1 5 6 1" + } ) + add( new FormComponent( "javax.swing.JLabel" ) { + name: "label4" + "text": "Dext" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 0 6" + } ) + add( new FormComponent( "javax.swing.JProgressBar" ) { + name: "progressBar1" + "value": 30 + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 1 6 6 1" + } ) + add( new FormComponent( "javax.swing.JProgressBar" ) { + name: "progressBar3" + "stringPainted": true + "value": 30 + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 1 6 6 1" + } ) + add( new FormComponent( "javax.swing.JSeparator" ) { + name: "separator1" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 1 6 6 1" + } ) + add( new FormComponent( "javax.swing.JLabel" ) { + name: "label5" + "text": "Dext" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 0 7" + } ) + add( new FormComponent( "javax.swing.JSlider" ) { + name: "slider2" + "orientation": 1 + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 1 7 6 1" + } ) + add( new FormComponent( "javax.swing.JSlider" ) { + name: "slider3" + "orientation": 1 + "paintTicks": true + "majorTickSpacing": 25 + "minorTickSpacing": 5 + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 1 7 6 1" + } ) + add( new FormComponent( "javax.swing.JProgressBar" ) { + name: "progressBar2" + "orientation": 1 + "value": 30 + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 1 7 6 1" + } ) + add( new FormComponent( "javax.swing.JProgressBar" ) { + name: "progressBar4" + "orientation": 1 + "stringPainted": true + "value": 30 + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 1 7 6 1" + } ) + add( new FormComponent( "com.jformdesigner.designer.wrapper.HSpacer" ) { + name: "hSpacer1" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 1 7 6 1,growx" + } ) + add( new FormComponent( "javax.swing.JLabel" ) { + name: "label9" + "text": "Dext" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 0 8" + } ) + add( new FormComponent( "javax.swing.JSlider" ) { + name: "slider4" + "orientation": 1 + "paintLabels": true + "majorTickSpacing": 25 + "minorTickSpacing": 5 + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 1 8 6 1" + } ) + add( new FormComponent( "javax.swing.JSlider" ) { + name: "slider5" + "orientation": 1 + "paintLabels": true + "paintTicks": true + "majorTickSpacing": 25 + "minorTickSpacing": 5 + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 1 8 6 1" + } ) + add( new FormComponent( "com.jformdesigner.designer.wrapper.HSpacer" ) { + name: "hSpacer2" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 1 8 6 1,growx" + } ) + }, new FormLayoutConstraints( null ) { + "location": new java.awt.Point( 0, 0 ) + "size": new java.awt.Dimension( 650, 660 ) + } ) + } +}