diff --git a/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatComponentStateTest.java b/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatComponentStateTest.java index 49a0e4d3..b457a26f 100644 --- a/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatComponentStateTest.java +++ b/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatComponentStateTest.java @@ -1076,7 +1076,7 @@ public class FlatComponentStateTest } } - //---- class TestStateCheckBox -------------------------------------------- + //---- class TestStateRadioButton ----------------------------------------- private static class TestStateRadioButton extends JRadioButton diff --git a/flatlaf-theme-editor/src/main/java/com/formdev/flatlaf/themeeditor/FlatThemeEditorPane.java b/flatlaf-theme-editor/src/main/java/com/formdev/flatlaf/themeeditor/FlatThemeEditorPane.java index f0d37ff6..a4b3d4da 100644 --- a/flatlaf-theme-editor/src/main/java/com/formdev/flatlaf/themeeditor/FlatThemeEditorPane.java +++ b/flatlaf-theme-editor/src/main/java/com/formdev/flatlaf/themeeditor/FlatThemeEditorPane.java @@ -31,7 +31,6 @@ import javax.swing.JFrame; import javax.swing.JLayer; import javax.swing.JOptionPane; import javax.swing.JPanel; -import javax.swing.JScrollPane; import javax.swing.KeyStroke; import javax.swing.SwingUtilities; import javax.swing.UIManager; @@ -68,7 +67,6 @@ class FlatThemeEditorPane private final FlatSyntaxTextArea textArea; private final ErrorStrip errorStrip; private FlatFindReplaceBar findReplaceBar; - private JScrollPane previewScrollPane; private FlatThemePreview preview; private File file; @@ -273,18 +271,12 @@ class FlatThemeEditorPane return; preview = new FlatThemePreview( textArea ); - previewScrollPane = new JScrollPane( preview ); - previewScrollPane.setHorizontalScrollBarPolicy( JScrollPane.HORIZONTAL_SCROLLBAR_NEVER ); - previewScrollPane.setBorder( BorderFactory.createEmptyBorder() ); - previewScrollPane.getVerticalScrollBar().setUnitIncrement( 20 ); - previewScrollPane.getHorizontalScrollBar().setUnitIncrement( 20 ); - add( previewScrollPane, BorderLayout.LINE_END ); + add( preview, BorderLayout.LINE_END ); } else { if( preview == null ) return; - remove( previewScrollPane ); - previewScrollPane = null; + remove( preview ); preview = null; } diff --git a/flatlaf-theme-editor/src/main/java/com/formdev/flatlaf/themeeditor/FlatThemePreview.java b/flatlaf-theme-editor/src/main/java/com/formdev/flatlaf/themeeditor/FlatThemePreview.java index eb3d857d..102b798e 100644 --- a/flatlaf-theme-editor/src/main/java/com/formdev/flatlaf/themeeditor/FlatThemePreview.java +++ b/flatlaf-theme-editor/src/main/java/com/formdev/flatlaf/themeeditor/FlatThemePreview.java @@ -18,25 +18,16 @@ package com.formdev.flatlaf.themeeditor; import java.awt.*; -import java.awt.event.ActionEvent; import java.awt.event.HierarchyEvent; -import java.beans.PropertyVetoException; import java.util.Map; import java.util.WeakHashMap; -import java.util.function.Function; import javax.swing.*; import javax.swing.UIDefaults.ActiveValue; import javax.swing.UIDefaults.LazyValue; import javax.swing.event.DocumentEvent; import javax.swing.event.DocumentListener; -import javax.swing.table.DefaultTableModel; -import javax.swing.table.TableRowSorter; -import javax.swing.tree.DefaultMutableTreeNode; -import javax.swing.tree.DefaultTreeModel; import com.formdev.flatlaf.FlatLaf; import com.formdev.flatlaf.extras.components.*; -import com.formdev.flatlaf.ui.FlatTabbedPaneUI; -import net.miginfocom.swing.*; /** * @author Karl Tauber @@ -56,36 +47,9 @@ class FlatThemePreview initComponents(); - tabbedPane1.uiDefaultsGetter = this::getUIDefaultProperty; - tabbedPane1.setTabLayoutPolicy( JTabbedPane.SCROLL_TAB_LAYOUT ); - tabbedPane1.addTab( "Tab 1", null ); - tabbedPane1.addTab( "Tab 2", null ); - tabbedPane1.addTab( "Tab 3", null ); - tabbedPane1.addTab( "Tab 4", null ); - tabbedPane1.addTab( "Tab 5", null ); - tabbedPane1.addTab( "Tab 6", null ); - tabbedPane1.addTab( "Tab 7", null ); - tabbedPane1.addTab( "Tab 8", null ); - - list1.setSelectedIndex( 1 ); - tree1.setSelectionRow( 1 ); - table1.setRowSelectionInterval( 1, 1 ); - table1.setRowSorter( new TableRowSorter<>( table1.getModel() ) ); - table1.getRowSorter().toggleSortOrder( 0 ); - table1.uiDefaultsGetter = this::getUIDefaultProperty; - - EventQueue.invokeLater( () -> { - int width = desktopPane1.getWidth(); - int height = desktopPane1.getHeight() / 2; - internalFrame1.setBounds( 0, 0, width, height ); - internalFrame2.setBounds( 0, height, width, height ); - - try { - internalFrame1.setSelected( true ); - } catch( PropertyVetoException ex ) { - // ignore - } - } ); + tabbedPane.addTab( "All", createPreviewTab( new FlatThemePreviewAll( this ) ) ); + tabbedPane.addTab( "Buttons", createPreviewTab( new FlatThemePreviewButtons() ) ); + tabbedPane.addTab( "Switches", createPreviewTab( new FlatThemePreviewSwitches() ) ); // timer used for delayed preview updates timer = new Timer( 300, e -> update() ); @@ -101,6 +65,15 @@ class FlatThemePreview } ); } + private JScrollPane createPreviewTab( JComponent c ) { + JScrollPane scrollPane = new JScrollPane( new PreviewPanel( c ) ); + scrollPane.setHorizontalScrollBarPolicy( JScrollPane.HORIZONTAL_SCROLLBAR_NEVER ); + scrollPane.setBorder( BorderFactory.createEmptyBorder() ); + scrollPane.getVerticalScrollBar().setUnitIncrement( 20 ); + scrollPane.getHorizontalScrollBar().setUnitIncrement( 20 ); + return scrollPane; + } + @Override public void insertUpdate( DocumentEvent e ) { timer.restart(); @@ -128,13 +101,18 @@ class FlatThemePreview private void updateComponentTreeUI() { try { - SwingUtilities.updateComponentTreeUI( this ); + Component selComp = tabbedPane.getSelectedComponent(); + if( selComp != null ) { + if( selComp instanceof JScrollPane ) + selComp = ((JScrollPane)selComp).getViewport().getView(); + SwingUtilities.updateComponentTreeUI( selComp ); + } } catch( Exception ex ) { ex.printStackTrace(); } } - private void runWithUIDefaultsGetter( Runnable runnable ) { + void runWithUIDefaultsGetter( Runnable runnable ) { try { runWithUIDefaultsGetterLevel++; if( runWithUIDefaultsGetterLevel == 1 ) @@ -146,7 +124,7 @@ class FlatThemePreview } } - private Object getUIDefaultProperty( Object key ) { + Object getUIDefaultProperty( Object key ) { if( !(key instanceof String) ) return null; @@ -178,919 +156,133 @@ class FlatThemePreview return value; } - @SuppressWarnings( "deprecation" ) - @Override - public void layout() { - try { - runWithUIDefaultsGetter( () -> { - super.layout(); - } ); - } catch( Exception ex ) { - ex.printStackTrace(); - } - } - - @Override - protected void validateTree() { - try { - runWithUIDefaultsGetter( () -> { - super.validateTree(); - } ); - } catch( Exception ex ) { - ex.printStackTrace(); - } - } - - @Override - public Dimension getPreferredSize() { - try { - return super.getPreferredSize(); - } catch( Exception ex ) { - ex.printStackTrace(); - return new Dimension( 100, 100 ); - } - } - - @Override - public Dimension getMinimumSize() { - try { - return super.getMinimumSize(); - } catch( Exception ex ) { - ex.printStackTrace(); - return new Dimension( 100, 100 ); - } - } - - @Override - public Dimension getMaximumSize() { - try { - return super.getMaximumSize(); - } catch( Exception ex ) { - ex.printStackTrace(); - return new Dimension( Short.MAX_VALUE, Short.MAX_VALUE ); - } - } - - @Override - public void paint( Graphics g ) { - try { - runWithUIDefaultsGetter( () -> { - super.paint( g ); - } ); - } catch( Exception ex ) { - ex.printStackTrace(); - } - } - - @Override - protected void paintComponent( Graphics g ) { - try { - runWithUIDefaultsGetter( () -> { - super.paintComponent( g ); - } ); - } catch( Exception ex ) { - ex.printStackTrace(); - } - } - - @Override - protected void paintChildren( Graphics g ) { - try { - runWithUIDefaultsGetter( () -> { - super.paintChildren( g ); - } ); - } catch( Exception ex ) { - ex.printStackTrace(); - } - } - - private void enabledChanged() { - runWithUIDefaultsGetter( () -> { - enableDisable( this, enabledCheckBox.isSelected() ); - } ); - } - - private void enableDisable( Component comp, boolean enabled ) { - if( comp != previewLabel && comp != enabledCheckBox && comp != menu2 ) - comp.setEnabled( enabled ); - - if( !(comp instanceof Container) || comp instanceof JInternalFrame ) - return; - - for( Component c : ((Container)comp).getComponents() ) { - if( c instanceof JScrollPane ) - c = ((JScrollPane)c).getViewport().getView(); - - // make sure that background is updated correctly in BasicTextUI.updateBackground() - if( c instanceof JTextPane ) - c.setBackground( UIManager.getColor( "TextPane.background" ) ); - else if( c instanceof JEditorPane ) - c.setBackground( UIManager.getColor( "EditorPane.background" ) ); - - enableDisable( c, enabled ); - } - - if( comp instanceof JMenu ) { - JMenu menu = (JMenu) comp; - int count = menu.getMenuComponentCount(); - for( int i = 0; i < count; i++ ) - enableDisable( menu.getMenuComponent( i ), enabled ); - } - } - - private void changeProgress() { - int value = slider3.getValue(); - progressBar1.setValue( value ); - progressBar2.setValue( value ); - } - - private Object toolbarCons; - - @Override - protected void addImpl( Component comp, Object constraints, int index ) { - // if floating toolbar window is closed, then place toolbar at original location - if( comp == toolBar1 ) { - if( toolbarCons == null ) - toolbarCons = constraints; - else if( comp.getParent() == null && toolbarCons != null ) - constraints = toolbarCons; - } - - super.addImpl( comp, constraints, index ); - } - private void initComponents() { // JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents + tabbedPane = new FlatTabbedPane(); previewSeparator = new JSeparator(); previewLabel = new JLabel(); - enabledCheckBox = new JCheckBox(); - separator2 = new JSeparator(); - labelLabel = new JLabel(); - label1 = new JLabel(); - flatButton1 = new FlatButton(); - buttonLabel = new JLabel(); - button1 = new JButton(); - testDefaultButton1 = new FlatThemePreview.PreviewDefaultButton(); - helpButton = new FlatButton(); - hSpacer2 = new JPanel(null); - toggleButtonLabel = new JLabel(); - toggleButton1 = new JToggleButton(); - toggleButton3 = new JToggleButton(); - hSpacer1 = new JPanel(null); - checkBoxLabel = new JLabel(); - checkBox1 = new JCheckBox(); - checkBox3 = new JCheckBox(); - hSpacer3 = new JPanel(null); - radioButtonLabel = new JLabel(); - radioButton1 = new JRadioButton(); - radioButton3 = new JRadioButton(); - hSpacer4 = new JPanel(null); - comboBoxLabel = new JLabel(); - comboBox1 = new FlatComboBox<>(); - comboBox3 = new JComboBox<>(); - spinnerLabel = new JLabel(); - spinner1 = new JSpinner(); - textFieldLabel = new JLabel(); - textField1 = new FlatTextField(); - formattedTextField1 = new FlatFormattedTextField(); - passwordField1 = new FlatPasswordField(); - textAreaLabel = new JLabel(); - scrollPane1 = new JScrollPane(); - textArea1 = new JTextArea(); - scrollPane5 = new JScrollPane(); - editorPane1 = new JEditorPane(); - scrollPane9 = new JScrollPane(); - textPane1 = new JTextPane(); - menuBarLabel = new JLabel(); - menuBar1 = new JMenuBar(); - menu2 = new JMenu(); - menuItem3 = new JMenuItem(); - menuItem4 = new JMenuItem(); - checkBoxMenuItem2 = new JCheckBoxMenuItem(); - checkBoxMenuItem3 = new JCheckBoxMenuItem(); - radioButtonMenuItem4 = new JRadioButtonMenuItem(); - radioButtonMenuItem5 = new JRadioButtonMenuItem(); - menu4 = new JMenu(); - menuItem6 = new JMenuItem(); - menu5 = new JMenu(); - menuItem7 = new JMenuItem(); - menu3 = new JMenu(); - menuItem5 = new JMenuItem(); - menuItem8 = new JMenuItem(); - menuItem9 = new JMenuItem(); - scrollBarLabel = new JLabel(); - scrollBar1 = new JScrollBar(); - scrollBar5 = new FlatScrollBar(); - separatorLabel = new JLabel(); - separator1 = new JSeparator(); - sliderLabel = new JLabel(); - slider1 = new JSlider(); - slider3 = new JSlider(); - progressBarLabel = new JLabel(); - progressBar1 = new FlatProgressBar(); - progressBar2 = new FlatProgressBar(); - toolTipLabel = new JLabel(); - toolTip1 = new JToolTip(); - toolBarLabel = new JLabel(); - toolBar1 = new JToolBar(); - button4 = new JButton(); - button6 = new JButton(); - button7 = new JToggleButton(); - button8 = new JToggleButton(); - tabbedPaneLabel = new JLabel(); - tabbedPane1 = new FlatThemePreview.PreviewTabbedPane(); - listTreeLabel = new JLabel(); - splitPane1 = new JSplitPane(); - scrollPane2 = new JScrollPane(); - list1 = new JList<>(); - scrollPane3 = new JScrollPane(); - tree1 = new JTree(); - tableLabel = new JLabel(); - scrollPane4 = new JScrollPane(); - table1 = new FlatThemePreview.PreviewTable(); - internalFrameLabel = new JLabel(); - desktopPane1 = new JDesktopPane(); - internalFrame1 = new JInternalFrame(); - internalFrame2 = new JInternalFrame(); //======== this ======== - setLayout(new MigLayout( - "insets dialog,hidemode 3", - // columns - "[fill]" + - "[130,fill]", - // rows - "[]0" + - "[]unrel" + - "[]" + - "[]" + - "[]" + - "[]" + - "[]" + - "[]" + - "[]" + - "[]" + - "[]" + - "[]" + - "[]" + - "[]" + - "[]" + - "[]" + - "[]" + - "[]" + - "[]" + - "[]" + - "[]" + - "[]" + - "[]" + - "[]" + - "[]" + - "[]" + - "[100,fill]" + - "[grow]")); + setLayout(new BorderLayout()); + + //======== tabbedPane ======== + { + tabbedPane.setLeadingComponent(previewLabel); + tabbedPane.setTabAreaAlignment(FlatTabbedPane.TabAreaAlignment.trailing); + tabbedPane.addChangeListener(e -> update()); + } + add(tabbedPane, BorderLayout.CENTER); //---- previewSeparator ---- previewSeparator.setOrientation(SwingConstants.VERTICAL); - add(previewSeparator, "west"); + add(previewSeparator, BorderLayout.LINE_START); //---- previewLabel ---- - previewLabel.setText("Preview"); + previewLabel.setText(" Preview "); previewLabel.setFont(previewLabel.getFont().deriveFont(previewLabel.getFont().getSize() + 6f)); - add(previewLabel, "cell 0 0 2 1,alignx left,growx 0"); - - //---- enabledCheckBox ---- - enabledCheckBox.setText("Enabled"); - enabledCheckBox.setSelected(true); - enabledCheckBox.addActionListener(e -> enabledChanged()); - add(enabledCheckBox, "cell 0 0 2 1,align right top,grow 0 0"); - add(separator2, "cell 0 1 2 1"); - - //---- labelLabel ---- - labelLabel.setText("JLabel:"); - add(labelLabel, "cell 0 2"); - - //---- label1 ---- - label1.setText("Some Text"); - add(label1, "cell 1 2"); - - //---- flatButton1 ---- - flatButton1.setText("Help"); - flatButton1.setButtonType(FlatButton.ButtonType.help); - flatButton1.setVisible(false); - add(flatButton1, "cell 1 1,alignx right,growx 0"); - - //---- buttonLabel ---- - buttonLabel.setText("JButton:"); - add(buttonLabel, "cell 0 3"); - - //---- button1 ---- - button1.setText("OK"); - add(button1, "cell 1 3,alignx left,growx 0"); - - //---- testDefaultButton1 ---- - testDefaultButton1.setText("Default"); - add(testDefaultButton1, "cell 1 3"); - - //---- helpButton ---- - helpButton.setButtonType(FlatButton.ButtonType.help); - add(helpButton, "cell 1 3"); - add(hSpacer2, "cell 1 3"); - - //---- toggleButtonLabel ---- - toggleButtonLabel.setText("JToggleButton:"); - add(toggleButtonLabel, "cell 0 4"); - - //---- toggleButton1 ---- - toggleButton1.setText("Unselected"); - add(toggleButton1, "cell 1 4,alignx left,growx 0"); - - //---- toggleButton3 ---- - toggleButton3.setText("Selected"); - toggleButton3.setSelected(true); - add(toggleButton3, "cell 1 4"); - add(hSpacer1, "cell 1 4"); - - //---- checkBoxLabel ---- - checkBoxLabel.setText("JCheckBox"); - add(checkBoxLabel, "cell 0 5"); - - //---- checkBox1 ---- - checkBox1.setText("Unselected"); - add(checkBox1, "cell 1 5,alignx left,growx 0"); - - //---- checkBox3 ---- - checkBox3.setText("Selected"); - checkBox3.setSelected(true); - add(checkBox3, "cell 1 5,alignx left,growx 0"); - add(hSpacer3, "cell 1 5"); - - //---- radioButtonLabel ---- - radioButtonLabel.setText("JRadioButton:"); - add(radioButtonLabel, "cell 0 6"); - - //---- radioButton1 ---- - radioButton1.setText("Unselected"); - add(radioButton1, "cell 1 6,alignx left,growx 0"); - - //---- radioButton3 ---- - radioButton3.setText("Selected"); - radioButton3.setSelected(true); - add(radioButton3, "cell 1 6,alignx left,growx 0"); - add(hSpacer4, "cell 1 6"); - - //---- comboBoxLabel ---- - comboBoxLabel.setText("JComboBox:"); - add(comboBoxLabel, "cell 0 7"); - - //---- comboBox1 ---- - comboBox1.setEditable(true); - comboBox1.setModel(new DefaultComboBoxModel<>(new String[] { - "Editable", - "a", - "bb", - "ccc", - "dd", - "e", - "ff", - "ggg", - "hh", - "i", - "jj", - "kkk" - })); - comboBox1.setMaximumRowCount(6); - comboBox1.setPlaceholderText("placeholder text"); - add(comboBox1, "cell 1 7,width 50"); - - //---- comboBox3 ---- - comboBox3.setModel(new DefaultComboBoxModel<>(new String[] { - "Not edit", - "a", - "bb", - "ccc", - "dd", - "e", - "ff", - "ggg", - "hh", - "i", - "jj", - "kkk" - })); - comboBox3.setMaximumRowCount(6); - add(comboBox3, "cell 1 7,width 50"); - - //---- spinnerLabel ---- - spinnerLabel.setText("JSpinner:"); - add(spinnerLabel, "cell 0 8"); - add(spinner1, "cell 1 8"); - - //---- textFieldLabel ---- - textFieldLabel.setText("JTextField:
JFormattedTextF.:
JPasswordField:"); - add(textFieldLabel, "cell 0 9 1 2"); - - //---- textField1 ---- - textField1.setText("Some Text"); - textField1.setPlaceholderText("placeholder text"); - add(textField1, "cell 1 9"); - - //---- formattedTextField1 ---- - formattedTextField1.setText("Some Text"); - formattedTextField1.setPlaceholderText("placeholder text"); - add(formattedTextField1, "cell 1 10,width 50"); - - //---- passwordField1 ---- - passwordField1.setText("Some Text"); - passwordField1.setPlaceholderText("placeholder text"); - add(passwordField1, "cell 1 10,width 50"); - - //---- textAreaLabel ---- - textAreaLabel.setText("JTextArea:

JEditorPane:
JTextPane:"); - add(textAreaLabel, "cell 0 11 1 2"); - - //======== scrollPane1 ======== - { - scrollPane1.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER); - scrollPane1.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); - - //---- textArea1 ---- - textArea1.setText("Some Text"); - textArea1.setRows(2); - scrollPane1.setViewportView(textArea1); - } - add(scrollPane1, "cell 1 11"); - - //======== scrollPane5 ======== - { - scrollPane5.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER); - scrollPane5.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); - - //---- editorPane1 ---- - editorPane1.setText("Some Text"); - scrollPane5.setViewportView(editorPane1); - } - add(scrollPane5, "cell 1 12,width 50"); - - //======== scrollPane9 ======== - { - scrollPane9.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER); - scrollPane9.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); - - //---- textPane1 ---- - textPane1.setText("Some Text"); - scrollPane9.setViewportView(textPane1); - } - add(scrollPane9, "cell 1 12,width 50"); - - //---- menuBarLabel ---- - menuBarLabel.setText("JMenuBar:"); - add(menuBarLabel, "cell 0 13"); - - //======== menuBar1 ======== - { - - //======== menu2 ======== - { - menu2.setText("JMenu"); - - //---- menuItem3 ---- - menuItem3.setText("JMenuItem"); - menu2.add(menuItem3); - - //---- menuItem4 ---- - menuItem4.setText("JMenuItem"); - menu2.add(menuItem4); - menu2.addSeparator(); - - //---- checkBoxMenuItem2 ---- - checkBoxMenuItem2.setText("JCheckBoxMenuItem"); - checkBoxMenuItem2.setSelected(true); - menu2.add(checkBoxMenuItem2); - - //---- checkBoxMenuItem3 ---- - checkBoxMenuItem3.setText("JCheckBoxMenuItem"); - menu2.add(checkBoxMenuItem3); - menu2.addSeparator(); - - //---- radioButtonMenuItem4 ---- - radioButtonMenuItem4.setText("JRadioButtonMenuItem"); - radioButtonMenuItem4.setSelected(true); - menu2.add(radioButtonMenuItem4); - - //---- radioButtonMenuItem5 ---- - radioButtonMenuItem5.setText("JRadioButtonMenuItem"); - menu2.add(radioButtonMenuItem5); - menu2.addSeparator(); - - //======== menu4 ======== - { - menu4.setText("JMenu"); - - //---- menuItem6 ---- - menuItem6.setText("JMenuItem"); - menu4.add(menuItem6); - } - menu2.add(menu4); - - //======== menu5 ======== - { - menu5.setText("JMenu"); - - //---- menuItem7 ---- - menuItem7.setText("JMenuItem"); - menu5.add(menuItem7); - } - menu2.add(menu5); - } - menuBar1.add(menu2); - - //======== menu3 ======== - { - menu3.setText("JMenu"); - - //---- menuItem5 ---- - menuItem5.setText("JMenuItem"); - menu3.add(menuItem5); - - //---- menuItem8 ---- - menuItem8.setText("JMenuItem"); - menu3.add(menuItem8); - - //---- menuItem9 ---- - menuItem9.setText("JMenuItem"); - menu3.add(menuItem9); - } - menuBar1.add(menu3); - } - add(menuBar1, "cell 1 13"); - - //---- scrollBarLabel ---- - scrollBarLabel.setText("JScrollBar:"); - add(scrollBarLabel, "cell 0 14"); - - //---- scrollBar1 ---- - scrollBar1.setOrientation(Adjustable.HORIZONTAL); - add(scrollBar1, "cell 1 14"); - - //---- scrollBar5 ---- - scrollBar5.setOrientation(Adjustable.HORIZONTAL); - scrollBar5.setShowButtons(true); - add(scrollBar5, "cell 1 15"); - - //---- separatorLabel ---- - separatorLabel.setText("JSeparator:"); - add(separatorLabel, "cell 0 16"); - add(separator1, "cell 1 16"); - - //---- sliderLabel ---- - sliderLabel.setText("JSlider:"); - add(sliderLabel, "cell 0 17"); - - //---- slider1 ---- - slider1.setValue(30); - add(slider1, "cell 1 17"); - - //---- slider3 ---- - slider3.setMinorTickSpacing(10); - slider3.setPaintTicks(true); - slider3.setMajorTickSpacing(50); - slider3.setPaintLabels(true); - slider3.setValue(30); - slider3.addChangeListener(e -> changeProgress()); - add(slider3, "cell 1 18"); - - //---- progressBarLabel ---- - progressBarLabel.setText("JProgressBar:"); - add(progressBarLabel, "cell 0 19"); - - //---- progressBar1 ---- - progressBar1.setValue(60); - add(progressBar1, "cell 1 19"); - - //---- progressBar2 ---- - progressBar2.setValue(50); - progressBar2.setStringPainted(true); - add(progressBar2, "cell 1 20"); - - //---- toolTipLabel ---- - toolTipLabel.setText("JToolTip:"); - add(toolTipLabel, "cell 0 21"); - - //---- toolTip1 ---- - toolTip1.setTipText("Some text in tool tip."); - add(toolTip1, "cell 1 21,alignx left,growx 0"); - - //---- toolBarLabel ---- - toolBarLabel.setText("JToolBar:"); - add(toolBarLabel, "cell 0 22"); - - //======== toolBar1 ======== - { - - //---- button4 ---- - button4.setIcon(UIManager.getIcon("Tree.closedIcon")); - toolBar1.add(button4); - - //---- button6 ---- - button6.setIcon(UIManager.getIcon("Tree.openIcon")); - toolBar1.add(button6); - toolBar1.addSeparator(); - - //---- button7 ---- - button7.setIcon(UIManager.getIcon("Tree.leafIcon")); - toolBar1.add(button7); - - //---- button8 ---- - button8.setIcon(UIManager.getIcon("Tree.leafIcon")); - button8.setSelected(true); - toolBar1.add(button8); - } - add(toolBar1, "cell 1 22"); - - //---- tabbedPaneLabel ---- - tabbedPaneLabel.setText("JTabbedPane:"); - add(tabbedPaneLabel, "cell 0 23"); - add(tabbedPane1, "cell 1 23"); - - //---- listTreeLabel ---- - listTreeLabel.setText("JList / JTree:
JSplitPane:"); - add(listTreeLabel, "cell 0 24,aligny top,growy 0"); - - //======== splitPane1 ======== - { - splitPane1.setResizeWeight(0.5); - - //======== scrollPane2 ======== - { - scrollPane2.setPreferredSize(new Dimension(50, 50)); - - //---- list1 ---- - list1.setModel(new AbstractListModel() { - String[] values = { - "Item 1", - "Item 2", - "Item 3" - }; - @Override - public int getSize() { return values.length; } - @Override - public String getElementAt(int i) { return values[i]; } - }); - scrollPane2.setViewportView(list1); - } - splitPane1.setLeftComponent(scrollPane2); - - //======== scrollPane3 ======== - { - scrollPane3.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); - scrollPane3.setPreferredSize(new Dimension(50, 50)); - - //---- tree1 ---- - tree1.setModel(new DefaultTreeModel( - new DefaultMutableTreeNode("Item 1") { - { - add(new DefaultMutableTreeNode("Item 2")); - add(new DefaultMutableTreeNode("Item 3")); - } - })); - scrollPane3.setViewportView(tree1); - } - splitPane1.setRightComponent(scrollPane3); - } - add(splitPane1, "cell 1 24,height 50"); - - //---- tableLabel ---- - tableLabel.setText("JTable:"); - add(tableLabel, "cell 0 25"); - - //======== scrollPane4 ======== - { - - //---- table1 ---- - table1.setModel(new DefaultTableModel( - new Object[][] { - {"Item 1a", "Item 1b"}, - {"Item 2a", "Item 2b"}, - }, - new String[] { - "Column 1", "Column 2" - } - )); - scrollPane4.setViewportView(table1); - } - add(scrollPane4, "cell 1 25,height 70"); - - //---- internalFrameLabel ---- - internalFrameLabel.setText("JDesktopPane:
JInternalFrame:"); - add(internalFrameLabel, "cell 0 26,aligny top,growy 0"); - - //======== desktopPane1 ======== - { - - //======== internalFrame1 ======== - { - internalFrame1.setVisible(true); - internalFrame1.setTitle("Active"); - internalFrame1.setClosable(true); - internalFrame1.setMaximizable(true); - internalFrame1.setIconifiable(true); - internalFrame1.setResizable(true); - Container internalFrame1ContentPane = internalFrame1.getContentPane(); - internalFrame1ContentPane.setLayout(new BorderLayout()); - } - desktopPane1.add(internalFrame1, JLayeredPane.DEFAULT_LAYER); - internalFrame1.setBounds(new Rectangle(new Point(5, 5), internalFrame1.getPreferredSize())); - - //======== internalFrame2 ======== - { - internalFrame2.setVisible(true); - internalFrame2.setClosable(true); - internalFrame2.setIconifiable(true); - internalFrame2.setMaximizable(true); - internalFrame2.setResizable(true); - internalFrame2.setTitle("Inactive"); - Container internalFrame2ContentPane = internalFrame2.getContentPane(); - internalFrame2ContentPane.setLayout(new BorderLayout()); - } - desktopPane1.add(internalFrame2, JLayeredPane.DEFAULT_LAYER); - internalFrame2.setBounds(new Rectangle(new Point(5, 50), internalFrame2.getPreferredSize())); - } - add(desktopPane1, "cell 1 26"); - - //---- buttonGroup1 ---- - ButtonGroup buttonGroup1 = new ButtonGroup(); - buttonGroup1.add(radioButton1); - buttonGroup1.add(radioButton3); - - //---- buttonGroup2 ---- - ButtonGroup buttonGroup2 = new ButtonGroup(); - buttonGroup2.add(radioButtonMenuItem4); - buttonGroup2.add(radioButtonMenuItem5); // JFormDesigner - End of component initialization //GEN-END:initComponents } // JFormDesigner - Variables declaration - DO NOT MODIFY //GEN-BEGIN:variables + private FlatTabbedPane tabbedPane; private JSeparator previewSeparator; private JLabel previewLabel; - private JCheckBox enabledCheckBox; - private JSeparator separator2; - private JLabel labelLabel; - private JLabel label1; - private FlatButton flatButton1; - private JLabel buttonLabel; - private JButton button1; - private FlatThemePreview.PreviewDefaultButton testDefaultButton1; - private FlatButton helpButton; - private JPanel hSpacer2; - private JLabel toggleButtonLabel; - private JToggleButton toggleButton1; - private JToggleButton toggleButton3; - private JPanel hSpacer1; - private JLabel checkBoxLabel; - private JCheckBox checkBox1; - private JCheckBox checkBox3; - private JPanel hSpacer3; - private JLabel radioButtonLabel; - private JRadioButton radioButton1; - private JRadioButton radioButton3; - private JPanel hSpacer4; - private JLabel comboBoxLabel; - private FlatComboBox comboBox1; - private JComboBox comboBox3; - private JLabel spinnerLabel; - private JSpinner spinner1; - private JLabel textFieldLabel; - private FlatTextField textField1; - private FlatFormattedTextField formattedTextField1; - private FlatPasswordField passwordField1; - private JLabel textAreaLabel; - private JScrollPane scrollPane1; - private JTextArea textArea1; - private JScrollPane scrollPane5; - private JEditorPane editorPane1; - private JScrollPane scrollPane9; - private JTextPane textPane1; - private JLabel menuBarLabel; - private JMenuBar menuBar1; - private JMenu menu2; - private JMenuItem menuItem3; - private JMenuItem menuItem4; - private JCheckBoxMenuItem checkBoxMenuItem2; - private JCheckBoxMenuItem checkBoxMenuItem3; - private JRadioButtonMenuItem radioButtonMenuItem4; - private JRadioButtonMenuItem radioButtonMenuItem5; - private JMenu menu4; - private JMenuItem menuItem6; - private JMenu menu5; - private JMenuItem menuItem7; - private JMenu menu3; - private JMenuItem menuItem5; - private JMenuItem menuItem8; - private JMenuItem menuItem9; - private JLabel scrollBarLabel; - private JScrollBar scrollBar1; - private FlatScrollBar scrollBar5; - private JLabel separatorLabel; - private JSeparator separator1; - private JLabel sliderLabel; - private JSlider slider1; - private JSlider slider3; - private JLabel progressBarLabel; - private FlatProgressBar progressBar1; - private FlatProgressBar progressBar2; - private JLabel toolTipLabel; - private JToolTip toolTip1; - private JLabel toolBarLabel; - private JToolBar toolBar1; - private JButton button4; - private JButton button6; - private JToggleButton button7; - private JToggleButton button8; - private JLabel tabbedPaneLabel; - private FlatThemePreview.PreviewTabbedPane tabbedPane1; - private JLabel listTreeLabel; - private JSplitPane splitPane1; - private JScrollPane scrollPane2; - private JList list1; - private JScrollPane scrollPane3; - private JTree tree1; - private JLabel tableLabel; - private JScrollPane scrollPane4; - private FlatThemePreview.PreviewTable table1; - private JLabel internalFrameLabel; - private JDesktopPane desktopPane1; - private JInternalFrame internalFrame1; - private JInternalFrame internalFrame2; // JFormDesigner - End of variables declaration //GEN-END:variables - //---- class PreviewDefaultButton ----------------------------------------- + //---- class PreviewPanel ------------------------------------------------- - private static class PreviewDefaultButton - extends JButton + private class PreviewPanel + extends JPanel { + PreviewPanel( JComponent c ) { + super( new BorderLayout() ); + add( c ); + } + + @SuppressWarnings( "deprecation" ) @Override - public boolean isDefaultButton() { - return true; - } - } - - //---- class PreviewTabbedPane -------------------------------------------- - - private static class PreviewTabbedPane - extends JTabbedPane - { - Function uiDefaultsGetter; - - @Override - public void updateUI() { - setUI( new PreviewFlatTabbedPaneUI( uiDefaultsGetter ) ); - } - } - - //---- class PreviewFlatTabbedPaneUI -------------------------------------- - - private static class PreviewFlatTabbedPaneUI - extends FlatTabbedPaneUI - { - private final Function uiDefaultsGetter; - - PreviewFlatTabbedPaneUI( Function uiDefaultsGetter ) { - this.uiDefaultsGetter = uiDefaultsGetter; - } - - @Override - protected JButton createMoreTabsButton() { - return new PreviewFlatMoreTabsButton(); - } - - //---- class PreviewFlatMoreTabsButton -------------------------------- - - protected class PreviewFlatMoreTabsButton - extends FlatMoreTabsButton - { - @Override - public void actionPerformed( ActionEvent e ) { - // needed for "more tabs" popup creation - FlatLaf.runWithUIDefaultsGetter( uiDefaultsGetter, () -> { - super.actionPerformed( e ); + public void layout() { + try { + runWithUIDefaultsGetter( () -> { + super.layout(); } ); + } catch( Exception ex ) { + ex.printStackTrace(); } } - } - //---- class PreviewTable ------------------------------------------------- + @Override + protected void validateTree() { + try { + runWithUIDefaultsGetter( () -> { + super.validateTree(); + } ); + } catch( Exception ex ) { + ex.printStackTrace(); + } + } - private static class PreviewTable - extends JTable - { - Function uiDefaultsGetter; + @Override + public Dimension getPreferredSize() { + try { + return super.getPreferredSize(); + } catch( Exception ex ) { + ex.printStackTrace(); + return new Dimension( 100, 100 ); + } + } + + @Override + public Dimension getMinimumSize() { + try { + return super.getMinimumSize(); + } catch( Exception ex ) { + ex.printStackTrace(); + return new Dimension( 100, 100 ); + } + } + + @Override + public Dimension getMaximumSize() { + try { + return super.getMaximumSize(); + } catch( Exception ex ) { + ex.printStackTrace(); + return new Dimension( Short.MAX_VALUE, Short.MAX_VALUE ); + } + } @Override public void paint( Graphics g ) { - // needed for DefaultTableCellRenderer - FlatLaf.runWithUIDefaultsGetter( uiDefaultsGetter, () -> { - super.paint( g ); - } ); + try { + runWithUIDefaultsGetter( () -> { + super.paint( g ); + } ); + } catch( Exception ex ) { + ex.printStackTrace(); + } + } + + @Override + protected void paintComponent( Graphics g ) { + try { + runWithUIDefaultsGetter( () -> { + super.paintComponent( g ); + } ); + } catch( Exception ex ) { + ex.printStackTrace(); + } + } + + @Override + protected void paintChildren( Graphics g ) { + try { + runWithUIDefaultsGetter( () -> { + super.paintChildren( g ); + } ); + } catch( Exception ex ) { + ex.printStackTrace(); + } } } } diff --git a/flatlaf-theme-editor/src/main/java/com/formdev/flatlaf/themeeditor/FlatThemePreview.jfd b/flatlaf-theme-editor/src/main/java/com/formdev/flatlaf/themeeditor/FlatThemePreview.jfd index f031b2b1..7d1e80a7 100644 --- a/flatlaf-theme-editor/src/main/java/com/formdev/flatlaf/themeeditor/FlatThemePreview.jfd +++ b/flatlaf-theme-editor/src/main/java/com/formdev/flatlaf/themeeditor/FlatThemePreview.jfd @@ -3,640 +3,33 @@ JFDML JFormDesigner: "7.0.4.0.360" Java: "16" encoding: "UTF-8" new FormModel { contentType: "form/swing" root: new FormRoot { - add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) { - "$layoutConstraints": "insets dialog,hidemode 3" - "$columnConstraints": "[fill][130,fill]" - "$rowConstraints": "[]0[]unrel[][][][][][][][][][][][][][][][][][][][][][][][][100,fill][grow]" - } ) { + add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class java.awt.BorderLayout ) ) { name: "this" + add( new FormContainer( "com.formdev.flatlaf.extras.components.FlatTabbedPane", new FormLayoutManager( class javax.swing.JTabbedPane ) ) { + name: "tabbedPane" + "leadingComponent": new FormReference( "previewLabel" ) + "tabAreaAlignment": enum com.formdev.flatlaf.extras.components.FlatTabbedPane$TabAreaAlignment trailing + addEvent( new FormEvent( "javax.swing.event.ChangeListener", "stateChanged", "update", false ) ) + }, new FormLayoutConstraints( class java.lang.String ) { + "value": "Center" + } ) add( new FormComponent( "javax.swing.JSeparator" ) { name: "previewSeparator" "orientation": 1 - }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { - "value": "west" - } ) - add( new FormComponent( "javax.swing.JLabel" ) { - name: "previewLabel" - "text": "Preview" - "font": new com.jformdesigner.model.SwingDerivedFont( null, 0, 6, false ) - }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { - "value": "cell 0 0 2 1,alignx left,growx 0" - } ) - add( new FormComponent( "javax.swing.JCheckBox" ) { - name: "enabledCheckBox" - "text": "Enabled" - "selected": true - addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "enabledChanged", false ) ) - }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { - "value": "cell 0 0 2 1,align right top,grow 0 0" - } ) - add( new FormComponent( "javax.swing.JSeparator" ) { - name: "separator2" - }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { - "value": "cell 0 1 2 1" - } ) - add( new FormComponent( "javax.swing.JLabel" ) { - name: "labelLabel" - "text": "JLabel:" - }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { - "value": "cell 0 2" - } ) - add( new FormComponent( "javax.swing.JLabel" ) { - name: "label1" - "text": "Some Text" - }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { - "value": "cell 1 2" - } ) - add( new FormComponent( "com.formdev.flatlaf.extras.components.FlatButton" ) { - name: "flatButton1" - "text": "Help" - "buttonType": enum com.formdev.flatlaf.extras.components.FlatButton$ButtonType help - "visible": false - }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { - "value": "cell 1 1,alignx right,growx 0" - } ) - add( new FormComponent( "javax.swing.JLabel" ) { - name: "buttonLabel" - "text": "JButton:" - }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { - "value": "cell 0 3" - } ) - add( new FormComponent( "javax.swing.JButton" ) { - name: "button1" - "text": "OK" - }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { - "value": "cell 1 3,alignx left,growx 0" - } ) - add( new FormComponent( "com.formdev.flatlaf.themeeditor.FlatThemePreview$PreviewDefaultButton" ) { - name: "testDefaultButton1" - "text": "Default" - }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { - "value": "cell 1 3" - } ) - add( new FormComponent( "com.formdev.flatlaf.extras.components.FlatButton" ) { - name: "helpButton" - "buttonType": enum com.formdev.flatlaf.extras.components.FlatButton$ButtonType help - }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { - "value": "cell 1 3" - } ) - add( new FormComponent( "com.jformdesigner.designer.wrapper.HSpacer" ) { - name: "hSpacer2" - }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { - "value": "cell 1 3" - } ) - add( new FormComponent( "javax.swing.JLabel" ) { - name: "toggleButtonLabel" - "text": "JToggleButton:" - }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { - "value": "cell 0 4" - } ) - add( new FormComponent( "javax.swing.JToggleButton" ) { - name: "toggleButton1" - "text": "Unselected" - }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { - "value": "cell 1 4,alignx left,growx 0" - } ) - add( new FormComponent( "javax.swing.JToggleButton" ) { - name: "toggleButton3" - "text": "Selected" - "selected": true - }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { - "value": "cell 1 4" - } ) - add( new FormComponent( "com.jformdesigner.designer.wrapper.HSpacer" ) { - name: "hSpacer1" - }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { - "value": "cell 1 4" - } ) - add( new FormComponent( "javax.swing.JLabel" ) { - name: "checkBoxLabel" - "text": "JCheckBox" - }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { - "value": "cell 0 5" - } ) - add( new FormComponent( "javax.swing.JCheckBox" ) { - name: "checkBox1" - "text": "Unselected" - }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { - "value": "cell 1 5,alignx left,growx 0" - } ) - add( new FormComponent( "javax.swing.JCheckBox" ) { - name: "checkBox3" - "text": "Selected" - "selected": true - }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { - "value": "cell 1 5,alignx left,growx 0" - } ) - add( new FormComponent( "com.jformdesigner.designer.wrapper.HSpacer" ) { - name: "hSpacer3" - }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { - "value": "cell 1 5" - } ) - add( new FormComponent( "javax.swing.JLabel" ) { - name: "radioButtonLabel" - "text": "JRadioButton:" - }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { - "value": "cell 0 6" - } ) - add( new FormComponent( "javax.swing.JRadioButton" ) { - name: "radioButton1" - "text": "Unselected" - "$buttonGroup": new FormReference( "buttonGroup1" ) - }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { - "value": "cell 1 6,alignx left,growx 0" - } ) - add( new FormComponent( "javax.swing.JRadioButton" ) { - name: "radioButton3" - "text": "Selected" - "selected": true - "$buttonGroup": new FormReference( "buttonGroup1" ) - }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { - "value": "cell 1 6,alignx left,growx 0" - } ) - add( new FormComponent( "com.jformdesigner.designer.wrapper.HSpacer" ) { - name: "hSpacer4" - }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { - "value": "cell 1 6" - } ) - add( new FormComponent( "javax.swing.JLabel" ) { - name: "comboBoxLabel" - "text": "JComboBox:" - }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { - "value": "cell 0 7" - } ) - add( new FormComponent( "com.formdev.flatlaf.extras.components.FlatComboBox" ) { - name: "comboBox1" - "editable": true - "model": new javax.swing.DefaultComboBoxModel { - selectedItem: "Editable" - addElement( "Editable" ) - addElement( "a" ) - addElement( "bb" ) - addElement( "ccc" ) - addElement( "dd" ) - addElement( "e" ) - addElement( "ff" ) - addElement( "ggg" ) - addElement( "hh" ) - addElement( "i" ) - addElement( "jj" ) - addElement( "kkk" ) - } - "maximumRowCount": 6 - "placeholderText": "placeholder text" - auxiliary() { - "JavaCodeGenerator.typeParameters": "String" - } - }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { - "value": "cell 1 7,width 50" - } ) - add( new FormComponent( "javax.swing.JComboBox" ) { - name: "comboBox3" - "model": new javax.swing.DefaultComboBoxModel { - selectedItem: "Not edit" - addElement( "Not edit" ) - addElement( "a" ) - addElement( "bb" ) - addElement( "ccc" ) - addElement( "dd" ) - addElement( "e" ) - addElement( "ff" ) - addElement( "ggg" ) - addElement( "hh" ) - addElement( "i" ) - addElement( "jj" ) - addElement( "kkk" ) - } - "maximumRowCount": 6 - }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { - "value": "cell 1 7,width 50" - } ) - add( new FormComponent( "javax.swing.JLabel" ) { - name: "spinnerLabel" - "text": "JSpinner:" - }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { - "value": "cell 0 8" - } ) - add( new FormComponent( "javax.swing.JSpinner" ) { - name: "spinner1" - }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { - "value": "cell 1 8" - } ) - add( new FormComponent( "javax.swing.JLabel" ) { - name: "textFieldLabel" - "text": "JTextField:
JFormattedTextF.:
JPasswordField:" - }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { - "value": "cell 0 9 1 2" - } ) - add( new FormComponent( "com.formdev.flatlaf.extras.components.FlatTextField" ) { - name: "textField1" - "text": "Some Text" - "placeholderText": "placeholder text" - auxiliary() { - "JavaCodeGenerator.variableLocal": false - } - }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { - "value": "cell 1 9" - } ) - add( new FormComponent( "com.formdev.flatlaf.extras.components.FlatFormattedTextField" ) { - name: "formattedTextField1" - "text": "Some Text" - "placeholderText": "placeholder text" - }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { - "value": "cell 1 10,width 50" - } ) - add( new FormComponent( "com.formdev.flatlaf.extras.components.FlatPasswordField" ) { - name: "passwordField1" - "text": "Some Text" - "placeholderText": "placeholder text" - }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { - "value": "cell 1 10,width 50" - } ) - add( new FormComponent( "javax.swing.JLabel" ) { - name: "textAreaLabel" - "text": "JTextArea:

JEditorPane:
JTextPane:" - }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { - "value": "cell 0 11 1 2" - } ) - add( new FormContainer( "javax.swing.JScrollPane", new FormLayoutManager( class javax.swing.JScrollPane ) ) { - name: "scrollPane1" - "verticalScrollBarPolicy": 21 - "horizontalScrollBarPolicy": 31 - add( new FormComponent( "javax.swing.JTextArea" ) { - name: "textArea1" - "text": "Some Text" - "rows": 2 - } ) - }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { - "value": "cell 1 11" - } ) - add( new FormContainer( "javax.swing.JScrollPane", new FormLayoutManager( class javax.swing.JScrollPane ) ) { - name: "scrollPane5" - "verticalScrollBarPolicy": 21 - "horizontalScrollBarPolicy": 31 - add( new FormComponent( "javax.swing.JEditorPane" ) { - name: "editorPane1" - "text": "Some Text" - } ) - }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { - "value": "cell 1 12,width 50" - } ) - add( new FormContainer( "javax.swing.JScrollPane", new FormLayoutManager( class javax.swing.JScrollPane ) ) { - name: "scrollPane9" - "verticalScrollBarPolicy": 21 - "horizontalScrollBarPolicy": 31 - add( new FormComponent( "javax.swing.JTextPane" ) { - name: "textPane1" - "text": "Some Text" - } ) - }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { - "value": "cell 1 12,width 50" - } ) - add( new FormComponent( "javax.swing.JLabel" ) { - name: "menuBarLabel" - "text": "JMenuBar:" - }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { - "value": "cell 0 13" - } ) - add( new FormContainer( "javax.swing.JMenuBar", new FormLayoutManager( class javax.swing.JMenuBar ) ) { - name: "menuBar1" - add( new FormContainer( "javax.swing.JMenu", new FormLayoutManager( class javax.swing.JMenu ) ) { - name: "menu2" - "text": "JMenu" - add( new FormComponent( "javax.swing.JMenuItem" ) { - name: "menuItem3" - "text": "JMenuItem" - } ) - add( new FormComponent( "javax.swing.JMenuItem" ) { - name: "menuItem4" - "text": "JMenuItem" - } ) - add( new FormComponent( "javax.swing.JPopupMenu$Separator" ) { - name: "separator7" - } ) - add( new FormComponent( "javax.swing.JCheckBoxMenuItem" ) { - name: "checkBoxMenuItem2" - "text": "JCheckBoxMenuItem" - "selected": true - } ) - add( new FormComponent( "javax.swing.JCheckBoxMenuItem" ) { - name: "checkBoxMenuItem3" - "text": "JCheckBoxMenuItem" - } ) - add( new FormComponent( "javax.swing.JPopupMenu$Separator" ) { - name: "separator9" - } ) - add( new FormComponent( "javax.swing.JRadioButtonMenuItem" ) { - name: "radioButtonMenuItem4" - "text": "JRadioButtonMenuItem" - "$buttonGroup": new FormReference( "buttonGroup2" ) - "selected": true - } ) - add( new FormComponent( "javax.swing.JRadioButtonMenuItem" ) { - name: "radioButtonMenuItem5" - "text": "JRadioButtonMenuItem" - "$buttonGroup": new FormReference( "buttonGroup2" ) - } ) - add( new FormComponent( "javax.swing.JPopupMenu$Separator" ) { - name: "separator3" - } ) - add( new FormContainer( "javax.swing.JMenu", new FormLayoutManager( class javax.swing.JMenu ) ) { - name: "menu4" - "text": "JMenu" - add( new FormComponent( "javax.swing.JMenuItem" ) { - name: "menuItem6" - "text": "JMenuItem" - } ) - } ) - add( new FormContainer( "javax.swing.JMenu", new FormLayoutManager( class javax.swing.JMenu ) ) { - name: "menu5" - "text": "JMenu" - add( new FormComponent( "javax.swing.JMenuItem" ) { - name: "menuItem7" - "text": "JMenuItem" - } ) - } ) - } ) - add( new FormContainer( "javax.swing.JMenu", new FormLayoutManager( class javax.swing.JMenu ) ) { - name: "menu3" - "text": "JMenu" - add( new FormComponent( "javax.swing.JMenuItem" ) { - name: "menuItem5" - "text": "JMenuItem" - } ) - add( new FormComponent( "javax.swing.JMenuItem" ) { - name: "menuItem8" - "text": "JMenuItem" - } ) - add( new FormComponent( "javax.swing.JMenuItem" ) { - name: "menuItem9" - "text": "JMenuItem" - } ) - } ) - }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { - "value": "cell 1 13" - } ) - add( new FormComponent( "javax.swing.JLabel" ) { - name: "scrollBarLabel" - "text": "JScrollBar:" - }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { - "value": "cell 0 14" - } ) - add( new FormComponent( "javax.swing.JScrollBar" ) { - name: "scrollBar1" - "orientation": 0 - }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { - "value": "cell 1 14" - } ) - add( new FormComponent( "com.formdev.flatlaf.extras.components.FlatScrollBar" ) { - name: "scrollBar5" - "orientation": 0 - "showButtons": true - }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { - "value": "cell 1 15" - } ) - add( new FormComponent( "javax.swing.JLabel" ) { - name: "separatorLabel" - "text": "JSeparator:" - }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { - "value": "cell 0 16" - } ) - add( new FormComponent( "javax.swing.JSeparator" ) { - name: "separator1" - }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { - "value": "cell 1 16" - } ) - add( new FormComponent( "javax.swing.JLabel" ) { - name: "sliderLabel" - "text": "JSlider:" - }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { - "value": "cell 0 17" - } ) - add( new FormComponent( "javax.swing.JSlider" ) { - name: "slider1" - "value": 30 - auxiliary() { - "JavaCodeGenerator.variableLocal": false - } - }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { - "value": "cell 1 17" - } ) - add( new FormComponent( "javax.swing.JSlider" ) { - name: "slider3" - "minorTickSpacing": 10 - "paintTicks": true - "majorTickSpacing": 50 - "paintLabels": true - "value": 30 - auxiliary() { - "JavaCodeGenerator.variableLocal": false - } - addEvent( new FormEvent( "javax.swing.event.ChangeListener", "stateChanged", "changeProgress", false ) ) - }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { - "value": "cell 1 18" - } ) - add( new FormComponent( "javax.swing.JLabel" ) { - name: "progressBarLabel" - "text": "JProgressBar:" - }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { - "value": "cell 0 19" - } ) - add( new FormComponent( "com.formdev.flatlaf.extras.components.FlatProgressBar" ) { - name: "progressBar1" - "value": 60 - }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { - "value": "cell 1 19" - } ) - add( new FormComponent( "com.formdev.flatlaf.extras.components.FlatProgressBar" ) { - name: "progressBar2" - "value": 50 - "stringPainted": true - }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { - "value": "cell 1 20" - } ) - add( new FormComponent( "javax.swing.JLabel" ) { - name: "toolTipLabel" - "text": "JToolTip:" - }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { - "value": "cell 0 21" - } ) - add( new FormComponent( "javax.swing.JToolTip" ) { - name: "toolTip1" - "tipText": "Some text in tool tip." - }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { - "value": "cell 1 21,alignx left,growx 0" - } ) - add( new FormComponent( "javax.swing.JLabel" ) { - name: "toolBarLabel" - "text": "JToolBar:" - }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { - "value": "cell 0 22" - } ) - add( new FormContainer( "javax.swing.JToolBar", new FormLayoutManager( class javax.swing.JToolBar ) ) { - name: "toolBar1" - add( new FormComponent( "javax.swing.JButton" ) { - name: "button4" - "icon": new com.jformdesigner.model.SwingIcon( 2, "Tree.closedIcon" ) - } ) - add( new FormComponent( "javax.swing.JButton" ) { - name: "button6" - "icon": new com.jformdesigner.model.SwingIcon( 2, "Tree.openIcon" ) - } ) - add( new FormComponent( "javax.swing.JToolBar$Separator" ) { - name: "separator4" - } ) - add( new FormComponent( "javax.swing.JToggleButton" ) { - name: "button7" - "icon": &SwingIcon0 new com.jformdesigner.model.SwingIcon( 2, "Tree.leafIcon" ) - } ) - add( new FormComponent( "javax.swing.JToggleButton" ) { - name: "button8" - "icon": #SwingIcon0 - "selected": true - } ) - }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { - "value": "cell 1 22" - } ) - add( new FormComponent( "javax.swing.JLabel" ) { - name: "tabbedPaneLabel" - "text": "JTabbedPane:" - }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { - "value": "cell 0 23" - } ) - add( new FormContainer( "com.formdev.flatlaf.themeeditor.FlatThemePreview$PreviewTabbedPane", new FormLayoutManager( class javax.swing.JTabbedPane ) ) { - name: "tabbedPane1" - }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { - "value": "cell 1 23" - } ) - add( new FormComponent( "javax.swing.JLabel" ) { - name: "listTreeLabel" - "text": "JList / JTree:
JSplitPane:" - }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { - "value": "cell 0 24,aligny top,growy 0" - } ) - add( new FormContainer( "javax.swing.JSplitPane", new FormLayoutManager( class javax.swing.JSplitPane ) ) { - name: "splitPane1" - "resizeWeight": 0.5 - add( new FormContainer( "javax.swing.JScrollPane", new FormLayoutManager( class javax.swing.JScrollPane ) ) { - name: "scrollPane2" - "preferredSize": new java.awt.Dimension( 50, 50 ) - add( new FormComponent( "javax.swing.JList" ) { - name: "list1" - "model": new javax.swing.DefaultListModel { - addElement( "Item 1" ) - addElement( "Item 2" ) - addElement( "Item 3" ) - } - } ) - }, new FormLayoutConstraints( class java.lang.String ) { - "value": "left" - } ) - add( new FormContainer( "javax.swing.JScrollPane", new FormLayoutManager( class javax.swing.JScrollPane ) ) { - name: "scrollPane3" - "horizontalScrollBarPolicy": 31 - "preferredSize": new java.awt.Dimension( 50, 50 ) - add( new FormComponent( "javax.swing.JTree" ) { - name: "tree1" - "model": new javax.swing.tree.DefaultTreeModel( new javax.swing.tree.DefaultMutableTreeNode { - userObject: "Item 1" - add( new javax.swing.tree.DefaultMutableTreeNode { - userObject: "Item 2" - } ) - add( new javax.swing.tree.DefaultMutableTreeNode { - userObject: "Item 3" - } ) - } ) - } ) - }, new FormLayoutConstraints( class java.lang.String ) { - "value": "right" - } ) - }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { - "value": "cell 1 24,height 50" - } ) - add( new FormComponent( "javax.swing.JLabel" ) { - name: "tableLabel" - "text": "JTable:" - }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { - "value": "cell 0 25" - } ) - add( new FormContainer( "javax.swing.JScrollPane", new FormLayoutManager( class javax.swing.JScrollPane ) ) { - name: "scrollPane4" - add( new FormComponent( "com.formdev.flatlaf.themeeditor.FlatThemePreview$PreviewTable" ) { - name: "table1" - "model": new com.jformdesigner.model.SwingTableModel( new java.util.Vector { - add( new java.util.Vector { - add( "Item 1a" ) - add( "Item 1b" ) - } ) - add( new java.util.Vector { - add( "Item 2a" ) - add( "Item 2b" ) - } ) - }, new java.util.Vector { - add( "Column 1" ) - add( "Column 2" ) - }, 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 1 25,height 70" - } ) - add( new FormComponent( "javax.swing.JLabel" ) { - name: "internalFrameLabel" - "text": "JDesktopPane:
JInternalFrame:" - }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { - "value": "cell 0 26,aligny top,growy 0" - } ) - add( new FormContainer( "javax.swing.JDesktopPane", new FormLayoutManager( class javax.swing.JDesktopPane ) ) { - name: "desktopPane1" - add( new FormContainer( "javax.swing.JInternalFrame", new FormLayoutManager( class java.awt.BorderLayout ) ) { - name: "internalFrame1" - "visible": true - "title": "Active" - "closable": true - "maximizable": true - "iconifiable": true - "resizable": true - }, new FormLayoutConstraints( null ) { - "x": 5 - "y": 5 - } ) - add( new FormContainer( "javax.swing.JInternalFrame", new FormLayoutManager( class java.awt.BorderLayout ) ) { - name: "internalFrame2" - "visible": true - "closable": true - "iconifiable": true - "maximizable": true - "resizable": true - "title": "Inactive" - }, new FormLayoutConstraints( null ) { - "x": 5 - "y": 50 - } ) - }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { - "value": "cell 1 26" + }, new FormLayoutConstraints( class java.lang.String ) { + "value": "Before" } ) }, new FormLayoutConstraints( null ) { "location": new java.awt.Point( 0, 0 ) - "size": new java.awt.Dimension( 400, 1070 ) + "size": new java.awt.Dimension( 320, 200 ) } ) - add( new FormNonVisual( "javax.swing.ButtonGroup" ) { - name: "buttonGroup1" + add( new FormComponent( "javax.swing.JLabel" ) { + name: "previewLabel" + "text": " Preview " + "font": new com.jformdesigner.model.SwingDerivedFont( null, 0, 6, false ) }, new FormLayoutConstraints( null ) { - "location": new java.awt.Point( 0, 1095 ) - } ) - add( new FormNonVisual( "javax.swing.ButtonGroup" ) { - name: "buttonGroup2" - }, new FormLayoutConstraints( null ) { - "location": new java.awt.Point( 0, 1145 ) + "location": new java.awt.Point( 0, 235 ) + "size": new java.awt.Dimension( 176, 24 ) } ) } } diff --git a/flatlaf-theme-editor/src/main/java/com/formdev/flatlaf/themeeditor/FlatThemePreviewAll.java b/flatlaf-theme-editor/src/main/java/com/formdev/flatlaf/themeeditor/FlatThemePreviewAll.java new file mode 100644 index 00000000..1ab0dcde --- /dev/null +++ b/flatlaf-theme-editor/src/main/java/com/formdev/flatlaf/themeeditor/FlatThemePreviewAll.java @@ -0,0 +1,891 @@ +/* +/* + * Copyright 2021 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.themeeditor; + +import java.awt.*; +import java.awt.event.ActionEvent; +import java.beans.PropertyVetoException; +import java.util.function.Function; +import javax.swing.*; +import javax.swing.table.DefaultTableModel; +import javax.swing.table.TableRowSorter; +import javax.swing.tree.DefaultMutableTreeNode; +import javax.swing.tree.DefaultTreeModel; +import com.formdev.flatlaf.FlatLaf; +import com.formdev.flatlaf.extras.components.*; +import com.formdev.flatlaf.ui.FlatTabbedPaneUI; +import net.miginfocom.swing.*; + +/** + * @author Karl Tauber + */ +class FlatThemePreviewAll + extends JPanel +{ + private final FlatThemePreview preview; + + FlatThemePreviewAll( FlatThemePreview preview ) { + this.preview = preview; + + initComponents(); + + tabbedPane1.uiDefaultsGetter = preview::getUIDefaultProperty; + tabbedPane1.setTabLayoutPolicy( JTabbedPane.SCROLL_TAB_LAYOUT ); + tabbedPane1.addTab( "Tab 1", null ); + tabbedPane1.addTab( "Tab 2", null ); + tabbedPane1.addTab( "Tab 3", null ); + tabbedPane1.addTab( "Tab 4", null ); + tabbedPane1.addTab( "Tab 5", null ); + tabbedPane1.addTab( "Tab 6", null ); + tabbedPane1.addTab( "Tab 7", null ); + tabbedPane1.addTab( "Tab 8", null ); + + list1.setSelectedIndex( 1 ); + tree1.setSelectionRow( 1 ); + table1.setRowSelectionInterval( 1, 1 ); + table1.setRowSorter( new TableRowSorter<>( table1.getModel() ) ); + table1.getRowSorter().toggleSortOrder( 0 ); + table1.uiDefaultsGetter = preview::getUIDefaultProperty; + + EventQueue.invokeLater( () -> { + int width = desktopPane1.getWidth(); + int height = desktopPane1.getHeight() / 2; + internalFrame1.setBounds( 0, 0, width, height ); + internalFrame2.setBounds( 0, height, width, height ); + + try { + internalFrame1.setSelected( true ); + } catch( PropertyVetoException ex ) { + // ignore + } + } ); + } + + private void enabledChanged() { + preview.runWithUIDefaultsGetter( () -> { + enableDisable( this, enabledCheckBox.isSelected() ); + } ); + } + + private void enableDisable( Component comp, boolean enabled ) { + if( comp != enabledCheckBox && comp != menu2 ) + comp.setEnabled( enabled ); + + if( !(comp instanceof Container) || comp instanceof JInternalFrame ) + return; + + for( Component c : ((Container)comp).getComponents() ) { + if( c instanceof JScrollPane ) + c = ((JScrollPane)c).getViewport().getView(); + + // make sure that background is updated correctly in BasicTextUI.updateBackground() + if( c instanceof JTextPane ) + c.setBackground( UIManager.getColor( "TextPane.background" ) ); + else if( c instanceof JEditorPane ) + c.setBackground( UIManager.getColor( "EditorPane.background" ) ); + + enableDisable( c, enabled ); + } + + if( comp instanceof JMenu ) { + JMenu menu = (JMenu) comp; + int count = menu.getMenuComponentCount(); + for( int i = 0; i < count; i++ ) + enableDisable( menu.getMenuComponent( i ), enabled ); + } + } + + private void changeProgress() { + int value = slider3.getValue(); + progressBar1.setValue( value ); + progressBar2.setValue( value ); + } + + private Object toolbarCons; + + @Override + protected void addImpl( Component comp, Object constraints, int index ) { + // if floating toolbar window is closed, then place toolbar at original location + if( comp == toolBar1 ) { + if( toolbarCons == null ) + toolbarCons = constraints; + else if( comp.getParent() == null && toolbarCons != null ) + constraints = toolbarCons; + } + + super.addImpl( comp, constraints, index ); + } + + private void initComponents() { + // JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents + enabledCheckBox = new JCheckBox(); + labelLabel = new JLabel(); + label1 = new JLabel(); + flatButton1 = new FlatButton(); + buttonLabel = new JLabel(); + button1 = new JButton(); + testDefaultButton1 = new FlatThemePreviewAll.PreviewDefaultButton(); + helpButton = new FlatButton(); + hSpacer2 = new JPanel(null); + toggleButtonLabel = new JLabel(); + toggleButton1 = new JToggleButton(); + toggleButton3 = new JToggleButton(); + hSpacer1 = new JPanel(null); + checkBoxLabel = new JLabel(); + checkBox1 = new JCheckBox(); + checkBox3 = new JCheckBox(); + hSpacer3 = new JPanel(null); + radioButtonLabel = new JLabel(); + radioButton1 = new JRadioButton(); + radioButton3 = new JRadioButton(); + hSpacer4 = new JPanel(null); + comboBoxLabel = new JLabel(); + comboBox1 = new FlatComboBox<>(); + comboBox3 = new JComboBox<>(); + spinnerLabel = new JLabel(); + spinner1 = new JSpinner(); + textFieldLabel = new JLabel(); + textField1 = new FlatTextField(); + formattedTextField1 = new FlatFormattedTextField(); + passwordField1 = new FlatPasswordField(); + textAreaLabel = new JLabel(); + scrollPane1 = new JScrollPane(); + textArea1 = new JTextArea(); + scrollPane5 = new JScrollPane(); + editorPane1 = new JEditorPane(); + scrollPane9 = new JScrollPane(); + textPane1 = new JTextPane(); + menuBarLabel = new JLabel(); + menuBar1 = new JMenuBar(); + menu2 = new JMenu(); + menuItem3 = new JMenuItem(); + menuItem4 = new JMenuItem(); + checkBoxMenuItem2 = new JCheckBoxMenuItem(); + checkBoxMenuItem3 = new JCheckBoxMenuItem(); + radioButtonMenuItem4 = new JRadioButtonMenuItem(); + radioButtonMenuItem5 = new JRadioButtonMenuItem(); + menu4 = new JMenu(); + menuItem6 = new JMenuItem(); + menu5 = new JMenu(); + menuItem7 = new JMenuItem(); + menu3 = new JMenu(); + menuItem5 = new JMenuItem(); + menuItem8 = new JMenuItem(); + menuItem9 = new JMenuItem(); + scrollBarLabel = new JLabel(); + scrollBar1 = new JScrollBar(); + scrollBar5 = new FlatScrollBar(); + separatorLabel = new JLabel(); + separator1 = new JSeparator(); + sliderLabel = new JLabel(); + slider1 = new JSlider(); + slider3 = new JSlider(); + progressBarLabel = new JLabel(); + progressBar1 = new FlatProgressBar(); + progressBar2 = new FlatProgressBar(); + toolTipLabel = new JLabel(); + toolTip1 = new JToolTip(); + toolBarLabel = new JLabel(); + toolBar1 = new JToolBar(); + button4 = new JButton(); + button6 = new JButton(); + button7 = new JToggleButton(); + button8 = new JToggleButton(); + tabbedPaneLabel = new JLabel(); + tabbedPane1 = new FlatThemePreviewAll.PreviewTabbedPane(); + listTreeLabel = new JLabel(); + splitPane1 = new JSplitPane(); + scrollPane2 = new JScrollPane(); + list1 = new JList<>(); + scrollPane3 = new JScrollPane(); + tree1 = new JTree(); + tableLabel = new JLabel(); + scrollPane4 = new JScrollPane(); + table1 = new FlatThemePreviewAll.PreviewTable(); + internalFrameLabel = new JLabel(); + desktopPane1 = new JDesktopPane(); + internalFrame1 = new JInternalFrame(); + internalFrame2 = new JInternalFrame(); + + //======== this ======== + setLayout(new MigLayout( + "insets dialog,hidemode 3", + // columns + "[fill]" + + "[130,fill]", + // rows + "[]unrel" + + "[]" + + "[]" + + "[]" + + "[]" + + "[]" + + "[]" + + "[]" + + "[]" + + "[]" + + "[]" + + "[]" + + "[]" + + "[]" + + "[]" + + "[]" + + "[]" + + "[]" + + "[]" + + "[]" + + "[]" + + "[]" + + "[]" + + "[]" + + "[]" + + "[100,fill]" + + "[grow]")); + + //---- enabledCheckBox ---- + enabledCheckBox.setText("Enabled"); + enabledCheckBox.setSelected(true); + enabledCheckBox.addActionListener(e -> enabledChanged()); + add(enabledCheckBox, "cell 0 0 2 1,alignx left,growx 0"); + + //---- labelLabel ---- + labelLabel.setText("JLabel:"); + add(labelLabel, "cell 0 1"); + + //---- label1 ---- + label1.setText("Some Text"); + add(label1, "cell 1 1"); + + //---- flatButton1 ---- + flatButton1.setText("Help"); + flatButton1.setButtonType(FlatButton.ButtonType.help); + flatButton1.setVisible(false); + add(flatButton1, "cell 1 1,alignx right,growx 0"); + + //---- buttonLabel ---- + buttonLabel.setText("JButton:"); + add(buttonLabel, "cell 0 2"); + + //---- button1 ---- + button1.setText("OK"); + add(button1, "cell 1 2,alignx left,growx 0"); + + //---- testDefaultButton1 ---- + testDefaultButton1.setText("Default"); + add(testDefaultButton1, "cell 1 2"); + + //---- helpButton ---- + helpButton.setButtonType(FlatButton.ButtonType.help); + add(helpButton, "cell 1 2"); + add(hSpacer2, "cell 1 2"); + + //---- toggleButtonLabel ---- + toggleButtonLabel.setText("JToggleButton:"); + add(toggleButtonLabel, "cell 0 3"); + + //---- toggleButton1 ---- + toggleButton1.setText("Unselected"); + add(toggleButton1, "cell 1 3,alignx left,growx 0"); + + //---- toggleButton3 ---- + toggleButton3.setText("Selected"); + toggleButton3.setSelected(true); + add(toggleButton3, "cell 1 3"); + add(hSpacer1, "cell 1 3"); + + //---- checkBoxLabel ---- + checkBoxLabel.setText("JCheckBox"); + add(checkBoxLabel, "cell 0 4"); + + //---- checkBox1 ---- + checkBox1.setText("Unselected"); + add(checkBox1, "cell 1 4,alignx left,growx 0"); + + //---- checkBox3 ---- + checkBox3.setText("Selected"); + checkBox3.setSelected(true); + add(checkBox3, "cell 1 4,alignx left,growx 0"); + add(hSpacer3, "cell 1 4"); + + //---- radioButtonLabel ---- + radioButtonLabel.setText("JRadioButton:"); + add(radioButtonLabel, "cell 0 5"); + + //---- radioButton1 ---- + radioButton1.setText("Unselected"); + add(radioButton1, "cell 1 5,alignx left,growx 0"); + + //---- radioButton3 ---- + radioButton3.setText("Selected"); + radioButton3.setSelected(true); + add(radioButton3, "cell 1 5,alignx left,growx 0"); + add(hSpacer4, "cell 1 5"); + + //---- comboBoxLabel ---- + comboBoxLabel.setText("JComboBox:"); + add(comboBoxLabel, "cell 0 6"); + + //---- comboBox1 ---- + comboBox1.setEditable(true); + comboBox1.setModel(new DefaultComboBoxModel<>(new String[] { + "Editable", + "a", + "bb", + "ccc", + "dd", + "e", + "ff", + "ggg", + "hh", + "i", + "jj", + "kkk" + })); + comboBox1.setMaximumRowCount(6); + comboBox1.setPlaceholderText("placeholder text"); + add(comboBox1, "cell 1 6,width 50"); + + //---- comboBox3 ---- + comboBox3.setModel(new DefaultComboBoxModel<>(new String[] { + "Not edit", + "a", + "bb", + "ccc", + "dd", + "e", + "ff", + "ggg", + "hh", + "i", + "jj", + "kkk" + })); + comboBox3.setMaximumRowCount(6); + add(comboBox3, "cell 1 6,width 50"); + + //---- spinnerLabel ---- + spinnerLabel.setText("JSpinner:"); + add(spinnerLabel, "cell 0 7"); + add(spinner1, "cell 1 7"); + + //---- textFieldLabel ---- + textFieldLabel.setText("JTextField:
JFormattedTextF.:
JPasswordField:"); + add(textFieldLabel, "cell 0 8 1 2"); + + //---- textField1 ---- + textField1.setText("Some Text"); + textField1.setPlaceholderText("placeholder text"); + add(textField1, "cell 1 8"); + + //---- formattedTextField1 ---- + formattedTextField1.setText("Some Text"); + formattedTextField1.setPlaceholderText("placeholder text"); + add(formattedTextField1, "cell 1 9,width 50"); + + //---- passwordField1 ---- + passwordField1.setText("Some Text"); + passwordField1.setPlaceholderText("placeholder text"); + add(passwordField1, "cell 1 9,width 50"); + + //---- textAreaLabel ---- + textAreaLabel.setText("JTextArea:

JEditorPane:
JTextPane:"); + add(textAreaLabel, "cell 0 10 1 2"); + + //======== scrollPane1 ======== + { + scrollPane1.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER); + scrollPane1.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); + + //---- textArea1 ---- + textArea1.setText("Some Text"); + textArea1.setRows(2); + scrollPane1.setViewportView(textArea1); + } + add(scrollPane1, "cell 1 10"); + + //======== scrollPane5 ======== + { + scrollPane5.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER); + scrollPane5.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); + + //---- editorPane1 ---- + editorPane1.setText("Some Text"); + scrollPane5.setViewportView(editorPane1); + } + add(scrollPane5, "cell 1 11,width 50"); + + //======== scrollPane9 ======== + { + scrollPane9.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER); + scrollPane9.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); + + //---- textPane1 ---- + textPane1.setText("Some Text"); + scrollPane9.setViewportView(textPane1); + } + add(scrollPane9, "cell 1 11,width 50"); + + //---- menuBarLabel ---- + menuBarLabel.setText("JMenuBar:"); + add(menuBarLabel, "cell 0 12"); + + //======== menuBar1 ======== + { + + //======== menu2 ======== + { + menu2.setText("JMenu"); + + //---- menuItem3 ---- + menuItem3.setText("JMenuItem"); + menu2.add(menuItem3); + + //---- menuItem4 ---- + menuItem4.setText("JMenuItem"); + menu2.add(menuItem4); + menu2.addSeparator(); + + //---- checkBoxMenuItem2 ---- + checkBoxMenuItem2.setText("JCheckBoxMenuItem"); + checkBoxMenuItem2.setSelected(true); + menu2.add(checkBoxMenuItem2); + + //---- checkBoxMenuItem3 ---- + checkBoxMenuItem3.setText("JCheckBoxMenuItem"); + menu2.add(checkBoxMenuItem3); + menu2.addSeparator(); + + //---- radioButtonMenuItem4 ---- + radioButtonMenuItem4.setText("JRadioButtonMenuItem"); + radioButtonMenuItem4.setSelected(true); + menu2.add(radioButtonMenuItem4); + + //---- radioButtonMenuItem5 ---- + radioButtonMenuItem5.setText("JRadioButtonMenuItem"); + menu2.add(radioButtonMenuItem5); + menu2.addSeparator(); + + //======== menu4 ======== + { + menu4.setText("JMenu"); + + //---- menuItem6 ---- + menuItem6.setText("JMenuItem"); + menu4.add(menuItem6); + } + menu2.add(menu4); + + //======== menu5 ======== + { + menu5.setText("JMenu"); + + //---- menuItem7 ---- + menuItem7.setText("JMenuItem"); + menu5.add(menuItem7); + } + menu2.add(menu5); + } + menuBar1.add(menu2); + + //======== menu3 ======== + { + menu3.setText("JMenu"); + + //---- menuItem5 ---- + menuItem5.setText("JMenuItem"); + menu3.add(menuItem5); + + //---- menuItem8 ---- + menuItem8.setText("JMenuItem"); + menu3.add(menuItem8); + + //---- menuItem9 ---- + menuItem9.setText("JMenuItem"); + menu3.add(menuItem9); + } + menuBar1.add(menu3); + } + add(menuBar1, "cell 1 12"); + + //---- scrollBarLabel ---- + scrollBarLabel.setText("JScrollBar:"); + add(scrollBarLabel, "cell 0 13"); + + //---- scrollBar1 ---- + scrollBar1.setOrientation(Adjustable.HORIZONTAL); + add(scrollBar1, "cell 1 13"); + + //---- scrollBar5 ---- + scrollBar5.setOrientation(Adjustable.HORIZONTAL); + scrollBar5.setShowButtons(true); + add(scrollBar5, "cell 1 14"); + + //---- separatorLabel ---- + separatorLabel.setText("JSeparator:"); + add(separatorLabel, "cell 0 15"); + add(separator1, "cell 1 15"); + + //---- sliderLabel ---- + sliderLabel.setText("JSlider:"); + add(sliderLabel, "cell 0 16"); + + //---- slider1 ---- + slider1.setValue(30); + add(slider1, "cell 1 16"); + + //---- slider3 ---- + slider3.setMinorTickSpacing(10); + slider3.setPaintTicks(true); + slider3.setMajorTickSpacing(50); + slider3.setPaintLabels(true); + slider3.setValue(30); + slider3.addChangeListener(e -> changeProgress()); + add(slider3, "cell 1 17"); + + //---- progressBarLabel ---- + progressBarLabel.setText("JProgressBar:"); + add(progressBarLabel, "cell 0 18"); + + //---- progressBar1 ---- + progressBar1.setValue(60); + add(progressBar1, "cell 1 18"); + + //---- progressBar2 ---- + progressBar2.setValue(50); + progressBar2.setStringPainted(true); + add(progressBar2, "cell 1 19"); + + //---- toolTipLabel ---- + toolTipLabel.setText("JToolTip:"); + add(toolTipLabel, "cell 0 20"); + + //---- toolTip1 ---- + toolTip1.setTipText("Some text in tool tip."); + add(toolTip1, "cell 1 20,alignx left,growx 0"); + + //---- toolBarLabel ---- + toolBarLabel.setText("JToolBar:"); + add(toolBarLabel, "cell 0 21"); + + //======== toolBar1 ======== + { + + //---- button4 ---- + button4.setIcon(UIManager.getIcon("Tree.closedIcon")); + toolBar1.add(button4); + + //---- button6 ---- + button6.setIcon(UIManager.getIcon("Tree.openIcon")); + toolBar1.add(button6); + toolBar1.addSeparator(); + + //---- button7 ---- + button7.setIcon(UIManager.getIcon("Tree.leafIcon")); + toolBar1.add(button7); + + //---- button8 ---- + button8.setIcon(UIManager.getIcon("Tree.leafIcon")); + button8.setSelected(true); + toolBar1.add(button8); + } + add(toolBar1, "cell 1 21"); + + //---- tabbedPaneLabel ---- + tabbedPaneLabel.setText("JTabbedPane:"); + add(tabbedPaneLabel, "cell 0 22"); + add(tabbedPane1, "cell 1 22"); + + //---- listTreeLabel ---- + listTreeLabel.setText("JList / JTree:
JSplitPane:"); + add(listTreeLabel, "cell 0 23,aligny top,growy 0"); + + //======== splitPane1 ======== + { + splitPane1.setResizeWeight(0.5); + + //======== scrollPane2 ======== + { + scrollPane2.setPreferredSize(new Dimension(50, 50)); + + //---- list1 ---- + list1.setModel(new AbstractListModel() { + String[] values = { + "Item 1", + "Item 2", + "Item 3" + }; + @Override + public int getSize() { return values.length; } + @Override + public String getElementAt(int i) { return values[i]; } + }); + scrollPane2.setViewportView(list1); + } + splitPane1.setLeftComponent(scrollPane2); + + //======== scrollPane3 ======== + { + scrollPane3.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); + scrollPane3.setPreferredSize(new Dimension(50, 50)); + + //---- tree1 ---- + tree1.setModel(new DefaultTreeModel( + new DefaultMutableTreeNode("Item 1") { + { + add(new DefaultMutableTreeNode("Item 2")); + add(new DefaultMutableTreeNode("Item 3")); + } + })); + scrollPane3.setViewportView(tree1); + } + splitPane1.setRightComponent(scrollPane3); + } + add(splitPane1, "cell 1 23,height 50"); + + //---- tableLabel ---- + tableLabel.setText("JTable:"); + add(tableLabel, "cell 0 24"); + + //======== scrollPane4 ======== + { + + //---- table1 ---- + table1.setModel(new DefaultTableModel( + new Object[][] { + {"Item 1a", "Item 1b"}, + {"Item 2a", "Item 2b"}, + }, + new String[] { + "Column 1", "Column 2" + } + )); + scrollPane4.setViewportView(table1); + } + add(scrollPane4, "cell 1 24,height 70"); + + //---- internalFrameLabel ---- + internalFrameLabel.setText("JDesktopPane:
JInternalFrame:"); + add(internalFrameLabel, "cell 0 25,aligny top,growy 0"); + + //======== desktopPane1 ======== + { + + //======== internalFrame1 ======== + { + internalFrame1.setVisible(true); + internalFrame1.setTitle("Active"); + internalFrame1.setClosable(true); + internalFrame1.setMaximizable(true); + internalFrame1.setIconifiable(true); + internalFrame1.setResizable(true); + Container internalFrame1ContentPane = internalFrame1.getContentPane(); + internalFrame1ContentPane.setLayout(new BorderLayout()); + } + desktopPane1.add(internalFrame1, JLayeredPane.DEFAULT_LAYER); + internalFrame1.setBounds(new Rectangle(new Point(5, 5), internalFrame1.getPreferredSize())); + + //======== internalFrame2 ======== + { + internalFrame2.setVisible(true); + internalFrame2.setClosable(true); + internalFrame2.setIconifiable(true); + internalFrame2.setMaximizable(true); + internalFrame2.setResizable(true); + internalFrame2.setTitle("Inactive"); + Container internalFrame2ContentPane = internalFrame2.getContentPane(); + internalFrame2ContentPane.setLayout(new BorderLayout()); + } + desktopPane1.add(internalFrame2, JLayeredPane.DEFAULT_LAYER); + internalFrame2.setBounds(new Rectangle(new Point(5, 50), internalFrame2.getPreferredSize())); + } + add(desktopPane1, "cell 1 25"); + + //---- buttonGroup1 ---- + ButtonGroup buttonGroup1 = new ButtonGroup(); + buttonGroup1.add(radioButton1); + buttonGroup1.add(radioButton3); + + //---- buttonGroup2 ---- + ButtonGroup buttonGroup2 = new ButtonGroup(); + buttonGroup2.add(radioButtonMenuItem4); + buttonGroup2.add(radioButtonMenuItem5); + // JFormDesigner - End of component initialization //GEN-END:initComponents + } + + // JFormDesigner - Variables declaration - DO NOT MODIFY //GEN-BEGIN:variables + private JCheckBox enabledCheckBox; + private JLabel labelLabel; + private JLabel label1; + private FlatButton flatButton1; + private JLabel buttonLabel; + private JButton button1; + private FlatThemePreviewAll.PreviewDefaultButton testDefaultButton1; + private FlatButton helpButton; + private JPanel hSpacer2; + private JLabel toggleButtonLabel; + private JToggleButton toggleButton1; + private JToggleButton toggleButton3; + private JPanel hSpacer1; + private JLabel checkBoxLabel; + private JCheckBox checkBox1; + private JCheckBox checkBox3; + private JPanel hSpacer3; + private JLabel radioButtonLabel; + private JRadioButton radioButton1; + private JRadioButton radioButton3; + private JPanel hSpacer4; + private JLabel comboBoxLabel; + private FlatComboBox comboBox1; + private JComboBox comboBox3; + private JLabel spinnerLabel; + private JSpinner spinner1; + private JLabel textFieldLabel; + private FlatTextField textField1; + private FlatFormattedTextField formattedTextField1; + private FlatPasswordField passwordField1; + private JLabel textAreaLabel; + private JScrollPane scrollPane1; + private JTextArea textArea1; + private JScrollPane scrollPane5; + private JEditorPane editorPane1; + private JScrollPane scrollPane9; + private JTextPane textPane1; + private JLabel menuBarLabel; + private JMenuBar menuBar1; + private JMenu menu2; + private JMenuItem menuItem3; + private JMenuItem menuItem4; + private JCheckBoxMenuItem checkBoxMenuItem2; + private JCheckBoxMenuItem checkBoxMenuItem3; + private JRadioButtonMenuItem radioButtonMenuItem4; + private JRadioButtonMenuItem radioButtonMenuItem5; + private JMenu menu4; + private JMenuItem menuItem6; + private JMenu menu5; + private JMenuItem menuItem7; + private JMenu menu3; + private JMenuItem menuItem5; + private JMenuItem menuItem8; + private JMenuItem menuItem9; + private JLabel scrollBarLabel; + private JScrollBar scrollBar1; + private FlatScrollBar scrollBar5; + private JLabel separatorLabel; + private JSeparator separator1; + private JLabel sliderLabel; + private JSlider slider1; + private JSlider slider3; + private JLabel progressBarLabel; + private FlatProgressBar progressBar1; + private FlatProgressBar progressBar2; + private JLabel toolTipLabel; + private JToolTip toolTip1; + private JLabel toolBarLabel; + private JToolBar toolBar1; + private JButton button4; + private JButton button6; + private JToggleButton button7; + private JToggleButton button8; + private JLabel tabbedPaneLabel; + private FlatThemePreviewAll.PreviewTabbedPane tabbedPane1; + private JLabel listTreeLabel; + private JSplitPane splitPane1; + private JScrollPane scrollPane2; + private JList list1; + private JScrollPane scrollPane3; + private JTree tree1; + private JLabel tableLabel; + private JScrollPane scrollPane4; + private FlatThemePreviewAll.PreviewTable table1; + private JLabel internalFrameLabel; + private JDesktopPane desktopPane1; + private JInternalFrame internalFrame1; + private JInternalFrame internalFrame2; + // JFormDesigner - End of variables declaration //GEN-END:variables + + //---- class PreviewDefaultButton ----------------------------------------- + + private static class PreviewDefaultButton + extends JButton + { + @Override + public boolean isDefaultButton() { + return true; + } + } + + //---- class PreviewTabbedPane -------------------------------------------- + + private static class PreviewTabbedPane + extends JTabbedPane + { + Function uiDefaultsGetter; + + @Override + public void updateUI() { + setUI( new PreviewFlatTabbedPaneUI( uiDefaultsGetter ) ); + } + } + + //---- class PreviewFlatTabbedPaneUI -------------------------------------- + + private static class PreviewFlatTabbedPaneUI + extends FlatTabbedPaneUI + { + private final Function uiDefaultsGetter; + + PreviewFlatTabbedPaneUI( Function uiDefaultsGetter ) { + this.uiDefaultsGetter = uiDefaultsGetter; + } + + @Override + protected JButton createMoreTabsButton() { + return new PreviewFlatMoreTabsButton(); + } + + //---- class PreviewFlatMoreTabsButton -------------------------------- + + protected class PreviewFlatMoreTabsButton + extends FlatMoreTabsButton + { + @Override + public void actionPerformed( ActionEvent e ) { + // needed for "more tabs" popup creation + FlatLaf.runWithUIDefaultsGetter( uiDefaultsGetter, () -> { + super.actionPerformed( e ); + } ); + } + } + } + + //---- class PreviewTable ------------------------------------------------- + + private static class PreviewTable + extends JTable + { + Function uiDefaultsGetter; + + @Override + public void paint( Graphics g ) { + // needed for DefaultTableCellRenderer + FlatLaf.runWithUIDefaultsGetter( uiDefaultsGetter, () -> { + super.paint( g ); + } ); + } + } +} diff --git a/flatlaf-theme-editor/src/main/java/com/formdev/flatlaf/themeeditor/FlatThemePreviewAll.jfd b/flatlaf-theme-editor/src/main/java/com/formdev/flatlaf/themeeditor/FlatThemePreviewAll.jfd new file mode 100644 index 00000000..563a63bb --- /dev/null +++ b/flatlaf-theme-editor/src/main/java/com/formdev/flatlaf/themeeditor/FlatThemePreviewAll.jfd @@ -0,0 +1,624 @@ +JFDML JFormDesigner: "7.0.4.0.360" Java: "16" encoding: "UTF-8" + +new FormModel { + contentType: "form/swing" + root: new FormRoot { + add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) { + "$layoutConstraints": "insets dialog,hidemode 3" + "$columnConstraints": "[fill][130,fill]" + "$rowConstraints": "[]unrel[][][][][][][][][][][][][][][][][][][][][][][][][100,fill][grow]" + } ) { + name: "this" + add( new FormComponent( "javax.swing.JCheckBox" ) { + name: "enabledCheckBox" + "text": "Enabled" + "selected": true + addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "enabledChanged", false ) ) + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 0 0 2 1,alignx left,growx 0" + } ) + add( new FormComponent( "javax.swing.JLabel" ) { + name: "labelLabel" + "text": "JLabel:" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 0 1" + } ) + add( new FormComponent( "javax.swing.JLabel" ) { + name: "label1" + "text": "Some Text" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 1 1" + } ) + add( new FormComponent( "com.formdev.flatlaf.extras.components.FlatButton" ) { + name: "flatButton1" + "text": "Help" + "buttonType": enum com.formdev.flatlaf.extras.components.FlatButton$ButtonType help + "visible": false + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 1 1,alignx right,growx 0" + } ) + add( new FormComponent( "javax.swing.JLabel" ) { + name: "buttonLabel" + "text": "JButton:" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 0 2" + } ) + add( new FormComponent( "javax.swing.JButton" ) { + name: "button1" + "text": "OK" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 1 2,alignx left,growx 0" + } ) + add( new FormComponent( "com.formdev.flatlaf.themeeditor.FlatThemePreviewAll$PreviewDefaultButton" ) { + name: "testDefaultButton1" + "text": "Default" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 1 2" + } ) + add( new FormComponent( "com.formdev.flatlaf.extras.components.FlatButton" ) { + name: "helpButton" + "buttonType": enum com.formdev.flatlaf.extras.components.FlatButton$ButtonType help + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 1 2" + } ) + add( new FormComponent( "com.jformdesigner.designer.wrapper.HSpacer" ) { + name: "hSpacer2" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 1 2" + } ) + add( new FormComponent( "javax.swing.JLabel" ) { + name: "toggleButtonLabel" + "text": "JToggleButton:" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 0 3" + } ) + add( new FormComponent( "javax.swing.JToggleButton" ) { + name: "toggleButton1" + "text": "Unselected" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 1 3,alignx left,growx 0" + } ) + add( new FormComponent( "javax.swing.JToggleButton" ) { + name: "toggleButton3" + "text": "Selected" + "selected": true + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 1 3" + } ) + add( new FormComponent( "com.jformdesigner.designer.wrapper.HSpacer" ) { + name: "hSpacer1" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 1 3" + } ) + add( new FormComponent( "javax.swing.JLabel" ) { + name: "checkBoxLabel" + "text": "JCheckBox" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 0 4" + } ) + add( new FormComponent( "javax.swing.JCheckBox" ) { + name: "checkBox1" + "text": "Unselected" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 1 4,alignx left,growx 0" + } ) + add( new FormComponent( "javax.swing.JCheckBox" ) { + name: "checkBox3" + "text": "Selected" + "selected": true + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 1 4,alignx left,growx 0" + } ) + add( new FormComponent( "com.jformdesigner.designer.wrapper.HSpacer" ) { + name: "hSpacer3" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 1 4" + } ) + add( new FormComponent( "javax.swing.JLabel" ) { + name: "radioButtonLabel" + "text": "JRadioButton:" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 0 5" + } ) + add( new FormComponent( "javax.swing.JRadioButton" ) { + name: "radioButton1" + "text": "Unselected" + "$buttonGroup": new FormReference( "buttonGroup1" ) + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 1 5,alignx left,growx 0" + } ) + add( new FormComponent( "javax.swing.JRadioButton" ) { + name: "radioButton3" + "text": "Selected" + "selected": true + "$buttonGroup": new FormReference( "buttonGroup1" ) + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 1 5,alignx left,growx 0" + } ) + add( new FormComponent( "com.jformdesigner.designer.wrapper.HSpacer" ) { + name: "hSpacer4" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 1 5" + } ) + add( new FormComponent( "javax.swing.JLabel" ) { + name: "comboBoxLabel" + "text": "JComboBox:" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 0 6" + } ) + add( new FormComponent( "com.formdev.flatlaf.extras.components.FlatComboBox" ) { + name: "comboBox1" + "editable": true + "model": new javax.swing.DefaultComboBoxModel { + selectedItem: "Editable" + addElement( "Editable" ) + addElement( "a" ) + addElement( "bb" ) + addElement( "ccc" ) + addElement( "dd" ) + addElement( "e" ) + addElement( "ff" ) + addElement( "ggg" ) + addElement( "hh" ) + addElement( "i" ) + addElement( "jj" ) + addElement( "kkk" ) + } + "maximumRowCount": 6 + "placeholderText": "placeholder text" + auxiliary() { + "JavaCodeGenerator.typeParameters": "String" + } + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 1 6,width 50" + } ) + add( new FormComponent( "javax.swing.JComboBox" ) { + name: "comboBox3" + "model": new javax.swing.DefaultComboBoxModel { + selectedItem: "Not edit" + addElement( "Not edit" ) + addElement( "a" ) + addElement( "bb" ) + addElement( "ccc" ) + addElement( "dd" ) + addElement( "e" ) + addElement( "ff" ) + addElement( "ggg" ) + addElement( "hh" ) + addElement( "i" ) + addElement( "jj" ) + addElement( "kkk" ) + } + "maximumRowCount": 6 + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 1 6,width 50" + } ) + add( new FormComponent( "javax.swing.JLabel" ) { + name: "spinnerLabel" + "text": "JSpinner:" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 0 7" + } ) + add( new FormComponent( "javax.swing.JSpinner" ) { + name: "spinner1" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 1 7" + } ) + add( new FormComponent( "javax.swing.JLabel" ) { + name: "textFieldLabel" + "text": "JTextField:
JFormattedTextF.:
JPasswordField:" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 0 8 1 2" + } ) + add( new FormComponent( "com.formdev.flatlaf.extras.components.FlatTextField" ) { + name: "textField1" + "text": "Some Text" + "placeholderText": "placeholder text" + auxiliary() { + "JavaCodeGenerator.variableLocal": false + } + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 1 8" + } ) + add( new FormComponent( "com.formdev.flatlaf.extras.components.FlatFormattedTextField" ) { + name: "formattedTextField1" + "text": "Some Text" + "placeholderText": "placeholder text" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 1 9,width 50" + } ) + add( new FormComponent( "com.formdev.flatlaf.extras.components.FlatPasswordField" ) { + name: "passwordField1" + "text": "Some Text" + "placeholderText": "placeholder text" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 1 9,width 50" + } ) + add( new FormComponent( "javax.swing.JLabel" ) { + name: "textAreaLabel" + "text": "JTextArea:

JEditorPane:
JTextPane:" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 0 10 1 2" + } ) + add( new FormContainer( "javax.swing.JScrollPane", new FormLayoutManager( class javax.swing.JScrollPane ) ) { + name: "scrollPane1" + "verticalScrollBarPolicy": 21 + "horizontalScrollBarPolicy": 31 + add( new FormComponent( "javax.swing.JTextArea" ) { + name: "textArea1" + "text": "Some Text" + "rows": 2 + } ) + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 1 10" + } ) + add( new FormContainer( "javax.swing.JScrollPane", new FormLayoutManager( class javax.swing.JScrollPane ) ) { + name: "scrollPane5" + "verticalScrollBarPolicy": 21 + "horizontalScrollBarPolicy": 31 + add( new FormComponent( "javax.swing.JEditorPane" ) { + name: "editorPane1" + "text": "Some Text" + } ) + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 1 11,width 50" + } ) + add( new FormContainer( "javax.swing.JScrollPane", new FormLayoutManager( class javax.swing.JScrollPane ) ) { + name: "scrollPane9" + "verticalScrollBarPolicy": 21 + "horizontalScrollBarPolicy": 31 + add( new FormComponent( "javax.swing.JTextPane" ) { + name: "textPane1" + "text": "Some Text" + } ) + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 1 11,width 50" + } ) + add( new FormComponent( "javax.swing.JLabel" ) { + name: "menuBarLabel" + "text": "JMenuBar:" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 0 12" + } ) + add( new FormContainer( "javax.swing.JMenuBar", new FormLayoutManager( class javax.swing.JMenuBar ) ) { + name: "menuBar1" + add( new FormContainer( "javax.swing.JMenu", new FormLayoutManager( class javax.swing.JMenu ) ) { + name: "menu2" + "text": "JMenu" + add( new FormComponent( "javax.swing.JMenuItem" ) { + name: "menuItem3" + "text": "JMenuItem" + } ) + add( new FormComponent( "javax.swing.JMenuItem" ) { + name: "menuItem4" + "text": "JMenuItem" + } ) + add( new FormComponent( "javax.swing.JPopupMenu$Separator" ) { + name: "separator7" + } ) + add( new FormComponent( "javax.swing.JCheckBoxMenuItem" ) { + name: "checkBoxMenuItem2" + "text": "JCheckBoxMenuItem" + "selected": true + } ) + add( new FormComponent( "javax.swing.JCheckBoxMenuItem" ) { + name: "checkBoxMenuItem3" + "text": "JCheckBoxMenuItem" + } ) + add( new FormComponent( "javax.swing.JPopupMenu$Separator" ) { + name: "separator9" + } ) + add( new FormComponent( "javax.swing.JRadioButtonMenuItem" ) { + name: "radioButtonMenuItem4" + "text": "JRadioButtonMenuItem" + "$buttonGroup": new FormReference( "buttonGroup2" ) + "selected": true + } ) + add( new FormComponent( "javax.swing.JRadioButtonMenuItem" ) { + name: "radioButtonMenuItem5" + "text": "JRadioButtonMenuItem" + "$buttonGroup": new FormReference( "buttonGroup2" ) + } ) + add( new FormComponent( "javax.swing.JPopupMenu$Separator" ) { + name: "separator3" + } ) + add( new FormContainer( "javax.swing.JMenu", new FormLayoutManager( class javax.swing.JMenu ) ) { + name: "menu4" + "text": "JMenu" + add( new FormComponent( "javax.swing.JMenuItem" ) { + name: "menuItem6" + "text": "JMenuItem" + } ) + } ) + add( new FormContainer( "javax.swing.JMenu", new FormLayoutManager( class javax.swing.JMenu ) ) { + name: "menu5" + "text": "JMenu" + add( new FormComponent( "javax.swing.JMenuItem" ) { + name: "menuItem7" + "text": "JMenuItem" + } ) + } ) + } ) + add( new FormContainer( "javax.swing.JMenu", new FormLayoutManager( class javax.swing.JMenu ) ) { + name: "menu3" + "text": "JMenu" + add( new FormComponent( "javax.swing.JMenuItem" ) { + name: "menuItem5" + "text": "JMenuItem" + } ) + add( new FormComponent( "javax.swing.JMenuItem" ) { + name: "menuItem8" + "text": "JMenuItem" + } ) + add( new FormComponent( "javax.swing.JMenuItem" ) { + name: "menuItem9" + "text": "JMenuItem" + } ) + } ) + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 1 12" + } ) + add( new FormComponent( "javax.swing.JLabel" ) { + name: "scrollBarLabel" + "text": "JScrollBar:" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 0 13" + } ) + add( new FormComponent( "javax.swing.JScrollBar" ) { + name: "scrollBar1" + "orientation": 0 + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 1 13" + } ) + add( new FormComponent( "com.formdev.flatlaf.extras.components.FlatScrollBar" ) { + name: "scrollBar5" + "orientation": 0 + "showButtons": true + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 1 14" + } ) + add( new FormComponent( "javax.swing.JLabel" ) { + name: "separatorLabel" + "text": "JSeparator:" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 0 15" + } ) + add( new FormComponent( "javax.swing.JSeparator" ) { + name: "separator1" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 1 15" + } ) + add( new FormComponent( "javax.swing.JLabel" ) { + name: "sliderLabel" + "text": "JSlider:" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 0 16" + } ) + add( new FormComponent( "javax.swing.JSlider" ) { + name: "slider1" + "value": 30 + auxiliary() { + "JavaCodeGenerator.variableLocal": false + } + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 1 16" + } ) + add( new FormComponent( "javax.swing.JSlider" ) { + name: "slider3" + "minorTickSpacing": 10 + "paintTicks": true + "majorTickSpacing": 50 + "paintLabels": true + "value": 30 + auxiliary() { + "JavaCodeGenerator.variableLocal": false + } + addEvent( new FormEvent( "javax.swing.event.ChangeListener", "stateChanged", "changeProgress", false ) ) + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 1 17" + } ) + add( new FormComponent( "javax.swing.JLabel" ) { + name: "progressBarLabel" + "text": "JProgressBar:" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 0 18" + } ) + add( new FormComponent( "com.formdev.flatlaf.extras.components.FlatProgressBar" ) { + name: "progressBar1" + "value": 60 + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 1 18" + } ) + add( new FormComponent( "com.formdev.flatlaf.extras.components.FlatProgressBar" ) { + name: "progressBar2" + "value": 50 + "stringPainted": true + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 1 19" + } ) + add( new FormComponent( "javax.swing.JLabel" ) { + name: "toolTipLabel" + "text": "JToolTip:" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 0 20" + } ) + add( new FormComponent( "javax.swing.JToolTip" ) { + name: "toolTip1" + "tipText": "Some text in tool tip." + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 1 20,alignx left,growx 0" + } ) + add( new FormComponent( "javax.swing.JLabel" ) { + name: "toolBarLabel" + "text": "JToolBar:" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 0 21" + } ) + add( new FormContainer( "javax.swing.JToolBar", new FormLayoutManager( class javax.swing.JToolBar ) ) { + name: "toolBar1" + add( new FormComponent( "javax.swing.JButton" ) { + name: "button4" + "icon": new com.jformdesigner.model.SwingIcon( 2, "Tree.closedIcon" ) + } ) + add( new FormComponent( "javax.swing.JButton" ) { + name: "button6" + "icon": new com.jformdesigner.model.SwingIcon( 2, "Tree.openIcon" ) + } ) + add( new FormComponent( "javax.swing.JToolBar$Separator" ) { + name: "separator4" + } ) + add( new FormComponent( "javax.swing.JToggleButton" ) { + name: "button7" + "icon": &SwingIcon0 new com.jformdesigner.model.SwingIcon( 2, "Tree.leafIcon" ) + } ) + add( new FormComponent( "javax.swing.JToggleButton" ) { + name: "button8" + "icon": #SwingIcon0 + "selected": true + } ) + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 1 21" + } ) + add( new FormComponent( "javax.swing.JLabel" ) { + name: "tabbedPaneLabel" + "text": "JTabbedPane:" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 0 22" + } ) + add( new FormContainer( "com.formdev.flatlaf.themeeditor.FlatThemePreviewAll$PreviewTabbedPane", new FormLayoutManager( class javax.swing.JTabbedPane ) ) { + name: "tabbedPane1" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 1 22" + } ) + add( new FormComponent( "javax.swing.JLabel" ) { + name: "listTreeLabel" + "text": "JList / JTree:
JSplitPane:" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 0 23,aligny top,growy 0" + } ) + add( new FormContainer( "javax.swing.JSplitPane", new FormLayoutManager( class javax.swing.JSplitPane ) ) { + name: "splitPane1" + "resizeWeight": 0.5 + add( new FormContainer( "javax.swing.JScrollPane", new FormLayoutManager( class javax.swing.JScrollPane ) ) { + name: "scrollPane2" + "preferredSize": new java.awt.Dimension( 50, 50 ) + add( new FormComponent( "javax.swing.JList" ) { + name: "list1" + "model": new javax.swing.DefaultListModel { + addElement( "Item 1" ) + addElement( "Item 2" ) + addElement( "Item 3" ) + } + } ) + }, new FormLayoutConstraints( class java.lang.String ) { + "value": "left" + } ) + add( new FormContainer( "javax.swing.JScrollPane", new FormLayoutManager( class javax.swing.JScrollPane ) ) { + name: "scrollPane3" + "horizontalScrollBarPolicy": 31 + "preferredSize": new java.awt.Dimension( 50, 50 ) + add( new FormComponent( "javax.swing.JTree" ) { + name: "tree1" + "model": new javax.swing.tree.DefaultTreeModel( new javax.swing.tree.DefaultMutableTreeNode { + userObject: "Item 1" + add( new javax.swing.tree.DefaultMutableTreeNode { + userObject: "Item 2" + } ) + add( new javax.swing.tree.DefaultMutableTreeNode { + userObject: "Item 3" + } ) + } ) + } ) + }, new FormLayoutConstraints( class java.lang.String ) { + "value": "right" + } ) + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 1 23,height 50" + } ) + add( new FormComponent( "javax.swing.JLabel" ) { + name: "tableLabel" + "text": "JTable:" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 0 24" + } ) + add( new FormContainer( "javax.swing.JScrollPane", new FormLayoutManager( class javax.swing.JScrollPane ) ) { + name: "scrollPane4" + add( new FormComponent( "com.formdev.flatlaf.themeeditor.FlatThemePreviewAll$PreviewTable" ) { + name: "table1" + "model": new com.jformdesigner.model.SwingTableModel( new java.util.Vector { + add( new java.util.Vector { + add( "Item 1a" ) + add( "Item 1b" ) + } ) + add( new java.util.Vector { + add( "Item 2a" ) + add( "Item 2b" ) + } ) + }, new java.util.Vector { + add( "Column 1" ) + add( "Column 2" ) + }, 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 1 24,height 70" + } ) + add( new FormComponent( "javax.swing.JLabel" ) { + name: "internalFrameLabel" + "text": "JDesktopPane:
JInternalFrame:" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 0 25,aligny top,growy 0" + } ) + add( new FormContainer( "javax.swing.JDesktopPane", new FormLayoutManager( class javax.swing.JDesktopPane ) ) { + name: "desktopPane1" + add( new FormContainer( "javax.swing.JInternalFrame", new FormLayoutManager( class java.awt.BorderLayout ) ) { + name: "internalFrame1" + "visible": true + "title": "Active" + "closable": true + "maximizable": true + "iconifiable": true + "resizable": true + }, new FormLayoutConstraints( null ) { + "x": 5 + "y": 5 + } ) + add( new FormContainer( "javax.swing.JInternalFrame", new FormLayoutManager( class java.awt.BorderLayout ) ) { + name: "internalFrame2" + "visible": true + "closable": true + "iconifiable": true + "maximizable": true + "resizable": true + "title": "Inactive" + }, new FormLayoutConstraints( null ) { + "x": 5 + "y": 50 + } ) + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 1 25" + } ) + }, new FormLayoutConstraints( null ) { + "location": new java.awt.Point( 0, 0 ) + "size": new java.awt.Dimension( 400, 1070 ) + } ) + add( new FormNonVisual( "javax.swing.ButtonGroup" ) { + name: "buttonGroup1" + }, new FormLayoutConstraints( null ) { + "location": new java.awt.Point( 0, 1095 ) + } ) + add( new FormNonVisual( "javax.swing.ButtonGroup" ) { + name: "buttonGroup2" + }, new FormLayoutConstraints( null ) { + "location": new java.awt.Point( 0, 1145 ) + } ) + } +} diff --git a/flatlaf-theme-editor/src/main/java/com/formdev/flatlaf/themeeditor/FlatThemePreviewButtons.java b/flatlaf-theme-editor/src/main/java/com/formdev/flatlaf/themeeditor/FlatThemePreviewButtons.java new file mode 100644 index 00000000..611876fb --- /dev/null +++ b/flatlaf-theme-editor/src/main/java/com/formdev/flatlaf/themeeditor/FlatThemePreviewButtons.java @@ -0,0 +1,705 @@ +/* + * Copyright 2021 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.themeeditor; + +import java.util.function.Predicate; +import javax.swing.*; +import com.formdev.flatlaf.FlatClientProperties; +import net.miginfocom.swing.*; + +/** + * @author Karl Tauber + */ +class FlatThemePreviewButtons + extends JPanel +{ + FlatThemePreviewButtons() { + initComponents(); + } + + private void initComponents() { + // JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents + label11 = new JLabel(); + label5 = new JLabel(); + label7 = new JLabel(); + label6 = new JLabel(); + label8 = new JLabel(); + label1 = new JLabel(); + testStateButton1 = new FlatThemePreviewButtons.TestStateButton(); + testStateButton7 = new FlatThemePreviewButtons.TestStateButton(); + testStateButton4 = new FlatThemePreviewButtons.TestStateButton(); + testStateButton10 = new FlatThemePreviewButtons.TestStateButton(); + label2 = new JLabel(); + testStateButton2 = new FlatThemePreviewButtons.TestStateButton(); + testStateButton8 = new FlatThemePreviewButtons.TestStateButton(); + testStateButton5 = new FlatThemePreviewButtons.TestStateButton(); + testStateButton11 = new FlatThemePreviewButtons.TestStateButton(); + label3 = new JLabel(); + testStateButton3 = new FlatThemePreviewButtons.TestStateButton(); + testStateButton9 = new FlatThemePreviewButtons.TestStateButton(); + testStateButton6 = new FlatThemePreviewButtons.TestStateButton(); + testStateButton12 = new FlatThemePreviewButtons.TestStateButton(); + label4 = new JLabel(); + testStateButton13 = new FlatThemePreviewButtons.TestStateButton(); + testStateButton14 = new FlatThemePreviewButtons.TestStateButton(); + label10 = new JLabel(); + button1 = new JButton(); + testDefaultButton1 = new FlatThemePreviewButtons.TestDefaultButton(); + label12 = new JLabel(); + label13 = new JLabel(); + label14 = new JLabel(); + label15 = new JLabel(); + label16 = new JLabel(); + label17 = new JLabel(); + testStateToggleButton1 = new FlatThemePreviewButtons.TestStateToggleButton(); + testStateToggleButton5 = new FlatThemePreviewButtons.TestStateToggleButton(); + testStateToggleButton9 = new FlatThemePreviewButtons.TestStateToggleButton(); + testStateToggleButton12 = new FlatThemePreviewButtons.TestStateToggleButton(); + label18 = new JLabel(); + testStateToggleButton2 = new FlatThemePreviewButtons.TestStateToggleButton(); + testStateToggleButton6 = new FlatThemePreviewButtons.TestStateToggleButton(); + testStateToggleButton10 = new FlatThemePreviewButtons.TestStateToggleButton(); + testStateToggleButton13 = new FlatThemePreviewButtons.TestStateToggleButton(); + label19 = new JLabel(); + testStateToggleButton3 = new FlatThemePreviewButtons.TestStateToggleButton(); + testStateToggleButton7 = new FlatThemePreviewButtons.TestStateToggleButton(); + testStateToggleButton11 = new FlatThemePreviewButtons.TestStateToggleButton(); + testStateToggleButton14 = new FlatThemePreviewButtons.TestStateToggleButton(); + label20 = new JLabel(); + testStateToggleButton4 = new FlatThemePreviewButtons.TestStateToggleButton(); + testStateToggleButton8 = new FlatThemePreviewButtons.TestStateToggleButton(); + label21 = new JLabel(); + toggleButton1 = new JToggleButton(); + toggleButton2 = new JToggleButton(); + label32 = new JLabel(); + label9 = new JLabel(); + label33 = new JLabel(); + label22 = new JLabel(); + testStateButton15 = new FlatThemePreviewButtons.TestStateButton(); + testStateButton19 = new FlatThemePreviewButtons.TestStateButton(); + label23 = new JLabel(); + testStateButton16 = new FlatThemePreviewButtons.TestStateButton(); + testStateButton20 = new FlatThemePreviewButtons.TestStateButton(); + label24 = new JLabel(); + testStateButton17 = new FlatThemePreviewButtons.TestStateButton(); + testStateButton21 = new FlatThemePreviewButtons.TestStateButton(); + label25 = new JLabel(); + testStateButton18 = new FlatThemePreviewButtons.TestStateButton(); + label26 = new JLabel(); + button2 = new JButton(); + + //======== this ======== + setLayout(new MigLayout( + "insets dialog,hidemode 3", + // columns + "[fill]" + + "[fill]" + + "[fill]para" + + "[fill]" + + "[fill]para", + // rows + "[]" + + "[]" + + "[]" + + "[]" + + "[]" + + "[]unrel" + + "[]para" + + "[]" + + "[]" + + "[]" + + "[]" + + "[]" + + "[]unrel" + + "[]para" + + "[]" + + "[]" + + "[]" + + "[]" + + "[]" + + "[]unrel" + + "[]")); + + //---- label11 ---- + label11.setText("JButton"); + label11.setFont(label11.getFont().deriveFont(label11.getFont().getSize() + 4f)); + add(label11, "cell 0 0 3 1"); + + //---- label5 ---- + label5.setText("regular"); + add(label5, "cell 1 1"); + + //---- label7 ---- + label7.setText("default"); + add(label7, "cell 2 1"); + + //---- label6 ---- + label6.setText("focused"); + add(label6, "cell 3 1"); + + //---- label8 ---- + label8.setText("default"); + add(label8, "cell 4 1"); + + //---- label1 ---- + label1.setText("none"); + add(label1, "cell 0 2"); + + //---- testStateButton1 ---- + testStateButton1.setText("OK"); + testStateButton1.putClientProperty("JComponent.minimumWidth", 0); + add(testStateButton1, "cell 1 2"); + + //---- testStateButton7 ---- + testStateButton7.setText("OK"); + testStateButton7.setStateDefault(true); + testStateButton7.putClientProperty("JComponent.minimumWidth", 0); + add(testStateButton7, "cell 2 2"); + + //---- testStateButton4 ---- + testStateButton4.setText("OK"); + testStateButton4.setStateFocused(true); + testStateButton4.putClientProperty("JComponent.minimumWidth", 0); + add(testStateButton4, "cell 3 2"); + + //---- testStateButton10 ---- + testStateButton10.setText("OK"); + testStateButton10.setStateFocused(true); + testStateButton10.setStateDefault(true); + testStateButton10.putClientProperty("JComponent.minimumWidth", 0); + add(testStateButton10, "cell 4 2"); + + //---- label2 ---- + label2.setText("hover"); + add(label2, "cell 0 3"); + + //---- testStateButton2 ---- + testStateButton2.setText("OK"); + testStateButton2.setStateHover(true); + testStateButton2.putClientProperty("JComponent.minimumWidth", 0); + add(testStateButton2, "cell 1 3"); + + //---- testStateButton8 ---- + testStateButton8.setText("OK"); + testStateButton8.setStateHover(true); + testStateButton8.setStateDefault(true); + testStateButton8.putClientProperty("JComponent.minimumWidth", 0); + add(testStateButton8, "cell 2 3"); + + //---- testStateButton5 ---- + testStateButton5.setText("OK"); + testStateButton5.setStateHover(true); + testStateButton5.setStateFocused(true); + testStateButton5.putClientProperty("JComponent.minimumWidth", 0); + add(testStateButton5, "cell 3 3"); + + //---- testStateButton11 ---- + testStateButton11.setText("OK"); + testStateButton11.setStateHover(true); + testStateButton11.setStateFocused(true); + testStateButton11.setStateDefault(true); + testStateButton11.putClientProperty("JComponent.minimumWidth", 0); + add(testStateButton11, "cell 4 3"); + + //---- label3 ---- + label3.setText("pressed"); + add(label3, "cell 0 4"); + + //---- testStateButton3 ---- + testStateButton3.setText("OK"); + testStateButton3.setStatePressed(true); + testStateButton3.putClientProperty("JComponent.minimumWidth", 0); + add(testStateButton3, "cell 1 4"); + + //---- testStateButton9 ---- + testStateButton9.setText("OK"); + testStateButton9.setStatePressed(true); + testStateButton9.setStateDefault(true); + testStateButton9.putClientProperty("JComponent.minimumWidth", 0); + add(testStateButton9, "cell 2 4"); + + //---- testStateButton6 ---- + testStateButton6.setText("OK"); + testStateButton6.setStatePressed(true); + testStateButton6.setStateFocused(true); + testStateButton6.putClientProperty("JComponent.minimumWidth", 0); + add(testStateButton6, "cell 3 4"); + + //---- testStateButton12 ---- + testStateButton12.setText("OK"); + testStateButton12.setStatePressed(true); + testStateButton12.setStateFocused(true); + testStateButton12.setStateDefault(true); + testStateButton12.putClientProperty("JComponent.minimumWidth", 0); + add(testStateButton12, "cell 4 4"); + + //---- label4 ---- + label4.setText("disabled"); + add(label4, "cell 0 5"); + + //---- testStateButton13 ---- + testStateButton13.setText("OK"); + testStateButton13.setEnabled(false); + testStateButton13.putClientProperty("JComponent.minimumWidth", 0); + add(testStateButton13, "cell 1 5"); + + //---- testStateButton14 ---- + testStateButton14.setText("OK"); + testStateButton14.setEnabled(false); + testStateButton14.setStateDefault(true); + testStateButton14.putClientProperty("JComponent.minimumWidth", 0); + add(testStateButton14, "cell 2 5"); + + //---- label10 ---- + label10.setText("try me"); + add(label10, "cell 0 6"); + + //---- button1 ---- + button1.setText("OK"); + button1.putClientProperty("JComponent.minimumWidth", 0); + add(button1, "cell 1 6"); + + //---- testDefaultButton1 ---- + testDefaultButton1.setText("OK"); + testDefaultButton1.putClientProperty("JComponent.minimumWidth", 0); + add(testDefaultButton1, "cell 2 6"); + + //---- label12 ---- + label12.setText("JToggleButton"); + label12.setFont(label12.getFont().deriveFont(label12.getFont().getSize() + 4f)); + add(label12, "cell 0 7 3 1"); + + //---- label13 ---- + label13.setText("unsel."); + add(label13, "cell 1 8"); + + //---- label14 ---- + label14.setText("selected"); + add(label14, "cell 2 8"); + + //---- label15 ---- + label15.setText("focused"); + add(label15, "cell 3 8"); + + //---- label16 ---- + label16.setText("selected"); + add(label16, "cell 4 8"); + + //---- label17 ---- + label17.setText("none"); + add(label17, "cell 0 9"); + + //---- testStateToggleButton1 ---- + testStateToggleButton1.setText("OK"); + add(testStateToggleButton1, "cell 1 9"); + + //---- testStateToggleButton5 ---- + testStateToggleButton5.setText("OK"); + testStateToggleButton5.setStateSelected(true); + add(testStateToggleButton5, "cell 2 9"); + + //---- testStateToggleButton9 ---- + testStateToggleButton9.setText("OK"); + testStateToggleButton9.setStateFocused(true); + add(testStateToggleButton9, "cell 3 9"); + + //---- testStateToggleButton12 ---- + testStateToggleButton12.setText("OK"); + testStateToggleButton12.setStateSelected(true); + testStateToggleButton12.setStateFocused(true); + add(testStateToggleButton12, "cell 4 9"); + + //---- label18 ---- + label18.setText("hover"); + add(label18, "cell 0 10"); + + //---- testStateToggleButton2 ---- + testStateToggleButton2.setText("OK"); + testStateToggleButton2.setStateHover(true); + add(testStateToggleButton2, "cell 1 10"); + + //---- testStateToggleButton6 ---- + testStateToggleButton6.setText("OK"); + testStateToggleButton6.setStateHover(true); + testStateToggleButton6.setStateSelected(true); + add(testStateToggleButton6, "cell 2 10"); + + //---- testStateToggleButton10 ---- + testStateToggleButton10.setText("OK"); + testStateToggleButton10.setStateHover(true); + testStateToggleButton10.setStateFocused(true); + add(testStateToggleButton10, "cell 3 10"); + + //---- testStateToggleButton13 ---- + testStateToggleButton13.setText("OK"); + testStateToggleButton13.setStateHover(true); + testStateToggleButton13.setStateSelected(true); + testStateToggleButton13.setStateFocused(true); + add(testStateToggleButton13, "cell 4 10"); + + //---- label19 ---- + label19.setText("pressed"); + add(label19, "cell 0 11"); + + //---- testStateToggleButton3 ---- + testStateToggleButton3.setText("OK"); + testStateToggleButton3.setStatePressed(true); + add(testStateToggleButton3, "cell 1 11"); + + //---- testStateToggleButton7 ---- + testStateToggleButton7.setText("OK"); + testStateToggleButton7.setStatePressed(true); + testStateToggleButton7.setStateSelected(true); + add(testStateToggleButton7, "cell 2 11"); + + //---- testStateToggleButton11 ---- + testStateToggleButton11.setText("OK"); + testStateToggleButton11.setStatePressed(true); + testStateToggleButton11.setStateFocused(true); + add(testStateToggleButton11, "cell 3 11"); + + //---- testStateToggleButton14 ---- + testStateToggleButton14.setText("OK"); + testStateToggleButton14.setStatePressed(true); + testStateToggleButton14.setStateSelected(true); + testStateToggleButton14.setStateFocused(true); + add(testStateToggleButton14, "cell 4 11"); + + //---- label20 ---- + label20.setText("disabled"); + add(label20, "cell 0 12"); + + //---- testStateToggleButton4 ---- + testStateToggleButton4.setText("OK"); + testStateToggleButton4.setEnabled(false); + add(testStateToggleButton4, "cell 1 12"); + + //---- testStateToggleButton8 ---- + testStateToggleButton8.setText("OK"); + testStateToggleButton8.setEnabled(false); + testStateToggleButton8.setStateSelected(true); + add(testStateToggleButton8, "cell 2 12"); + + //---- label21 ---- + label21.setText("try me"); + add(label21, "cell 0 13"); + + //---- toggleButton1 ---- + toggleButton1.setText("OK"); + add(toggleButton1, "cell 1 13"); + + //---- toggleButton2 ---- + toggleButton2.setText("OK"); + toggleButton2.setSelected(true); + add(toggleButton2, "cell 2 13"); + + //---- label32 ---- + label32.setText("Help Button"); + label32.setFont(label32.getFont().deriveFont(label32.getFont().getSize() + 4f)); + add(label32, "cell 0 14 2 1"); + + //---- label9 ---- + label9.setText("regular"); + add(label9, "cell 1 15"); + + //---- label33 ---- + label33.setText("focused"); + add(label33, "cell 2 15"); + + //---- label22 ---- + label22.setText("none"); + add(label22, "cell 0 16"); + + //---- testStateButton15 ---- + testStateButton15.putClientProperty("JComponent.minimumWidth", 0); + testStateButton15.putClientProperty("JButton.buttonType", "help"); + add(testStateButton15, "cell 1 16"); + + //---- testStateButton19 ---- + testStateButton19.setStateFocused(true); + testStateButton19.putClientProperty("JComponent.minimumWidth", 0); + testStateButton19.putClientProperty("JButton.buttonType", "help"); + add(testStateButton19, "cell 2 16"); + + //---- label23 ---- + label23.setText("hover"); + add(label23, "cell 0 17"); + + //---- testStateButton16 ---- + testStateButton16.setStateHover(true); + testStateButton16.putClientProperty("JComponent.minimumWidth", 0); + testStateButton16.putClientProperty("JButton.buttonType", "help"); + add(testStateButton16, "cell 1 17"); + + //---- testStateButton20 ---- + testStateButton20.setStateHover(true); + testStateButton20.setStateFocused(true); + testStateButton20.putClientProperty("JComponent.minimumWidth", 0); + testStateButton20.putClientProperty("JButton.buttonType", "help"); + add(testStateButton20, "cell 2 17"); + + //---- label24 ---- + label24.setText("pressed"); + add(label24, "cell 0 18"); + + //---- testStateButton17 ---- + testStateButton17.setStatePressed(true); + testStateButton17.putClientProperty("JComponent.minimumWidth", 0); + testStateButton17.putClientProperty("JButton.buttonType", "help"); + add(testStateButton17, "cell 1 18"); + + //---- testStateButton21 ---- + testStateButton21.setStatePressed(true); + testStateButton21.setStateFocused(true); + testStateButton21.putClientProperty("JComponent.minimumWidth", 0); + testStateButton21.putClientProperty("JButton.buttonType", "help"); + add(testStateButton21, "cell 2 18"); + + //---- label25 ---- + label25.setText("disabled"); + add(label25, "cell 0 19"); + + //---- testStateButton18 ---- + testStateButton18.setEnabled(false); + testStateButton18.putClientProperty("JComponent.minimumWidth", 0); + testStateButton18.putClientProperty("JButton.buttonType", "help"); + add(testStateButton18, "cell 1 19"); + + //---- label26 ---- + label26.setText("try me"); + add(label26, "cell 0 20"); + + //---- button2 ---- + button2.putClientProperty("JComponent.minimumWidth", 0); + button2.putClientProperty("JButton.buttonType", "help"); + add(button2, "cell 1 20"); + // JFormDesigner - End of component initialization //GEN-END:initComponents + } + + // JFormDesigner - Variables declaration - DO NOT MODIFY //GEN-BEGIN:variables + private JLabel label11; + private JLabel label5; + private JLabel label7; + private JLabel label6; + private JLabel label8; + private JLabel label1; + private FlatThemePreviewButtons.TestStateButton testStateButton1; + private FlatThemePreviewButtons.TestStateButton testStateButton7; + private FlatThemePreviewButtons.TestStateButton testStateButton4; + private FlatThemePreviewButtons.TestStateButton testStateButton10; + private JLabel label2; + private FlatThemePreviewButtons.TestStateButton testStateButton2; + private FlatThemePreviewButtons.TestStateButton testStateButton8; + private FlatThemePreviewButtons.TestStateButton testStateButton5; + private FlatThemePreviewButtons.TestStateButton testStateButton11; + private JLabel label3; + private FlatThemePreviewButtons.TestStateButton testStateButton3; + private FlatThemePreviewButtons.TestStateButton testStateButton9; + private FlatThemePreviewButtons.TestStateButton testStateButton6; + private FlatThemePreviewButtons.TestStateButton testStateButton12; + private JLabel label4; + private FlatThemePreviewButtons.TestStateButton testStateButton13; + private FlatThemePreviewButtons.TestStateButton testStateButton14; + private JLabel label10; + private JButton button1; + private FlatThemePreviewButtons.TestDefaultButton testDefaultButton1; + private JLabel label12; + private JLabel label13; + private JLabel label14; + private JLabel label15; + private JLabel label16; + private JLabel label17; + private FlatThemePreviewButtons.TestStateToggleButton testStateToggleButton1; + private FlatThemePreviewButtons.TestStateToggleButton testStateToggleButton5; + private FlatThemePreviewButtons.TestStateToggleButton testStateToggleButton9; + private FlatThemePreviewButtons.TestStateToggleButton testStateToggleButton12; + private JLabel label18; + private FlatThemePreviewButtons.TestStateToggleButton testStateToggleButton2; + private FlatThemePreviewButtons.TestStateToggleButton testStateToggleButton6; + private FlatThemePreviewButtons.TestStateToggleButton testStateToggleButton10; + private FlatThemePreviewButtons.TestStateToggleButton testStateToggleButton13; + private JLabel label19; + private FlatThemePreviewButtons.TestStateToggleButton testStateToggleButton3; + private FlatThemePreviewButtons.TestStateToggleButton testStateToggleButton7; + private FlatThemePreviewButtons.TestStateToggleButton testStateToggleButton11; + private FlatThemePreviewButtons.TestStateToggleButton testStateToggleButton14; + private JLabel label20; + private FlatThemePreviewButtons.TestStateToggleButton testStateToggleButton4; + private FlatThemePreviewButtons.TestStateToggleButton testStateToggleButton8; + private JLabel label21; + private JToggleButton toggleButton1; + private JToggleButton toggleButton2; + private JLabel label32; + private JLabel label9; + private JLabel label33; + private JLabel label22; + private FlatThemePreviewButtons.TestStateButton testStateButton15; + private FlatThemePreviewButtons.TestStateButton testStateButton19; + private JLabel label23; + private FlatThemePreviewButtons.TestStateButton testStateButton16; + private FlatThemePreviewButtons.TestStateButton testStateButton20; + private JLabel label24; + private FlatThemePreviewButtons.TestStateButton testStateButton17; + private FlatThemePreviewButtons.TestStateButton testStateButton21; + private JLabel label25; + private FlatThemePreviewButtons.TestStateButton testStateButton18; + private JLabel label26; + private JButton button2; + // JFormDesigner - End of variables declaration //GEN-END:variables + + //---- class TestStateButton ---------------------------------------------- + + private static class TestStateButton + extends JButton + { + private boolean stateHover; + private boolean statePressed; + private boolean stateFocused; + private boolean stateDefault; + + public TestStateButton() { + setModel( new DefaultButtonModel() { + @Override + public boolean isRollover() { + return isStateHover(); + } + @Override + public boolean isPressed() { + return isStatePressed(); + } + } ); + + putClientProperty( FlatClientProperties.COMPONENT_FOCUS_OWNER, + (Predicate) c -> { + return ((TestStateButton)c).isStateFocused(); + } ); + } + + public boolean isStateHover() { + return stateHover; + } + + public void setStateHover( boolean stateHover ) { + this.stateHover = stateHover; + } + + public boolean isStatePressed() { + return statePressed; + } + + public void setStatePressed( boolean statePressed ) { + this.statePressed = statePressed; + } + + public boolean isStateFocused() { + return stateFocused; + } + + public void setStateFocused( boolean stateFocused ) { + this.stateFocused = stateFocused; + } + + public boolean isStateDefault() { + return stateDefault; + } + + public void setStateDefault( boolean stateDefault ) { + this.stateDefault = stateDefault; + } + + @Override + public boolean isDefaultButton() { + return isStateDefault(); + } + } + + //---- class TestStateToggleButton ---------------------------------------- + + private static class TestStateToggleButton + extends JToggleButton + { + private boolean stateHover; + private boolean statePressed; + private boolean stateFocused; + private boolean stateSelected; + + public TestStateToggleButton() { + setModel( new DefaultButtonModel() { + @Override + public boolean isRollover() { + return isStateHover(); + } + @Override + public boolean isPressed() { + return isStatePressed(); + } + @Override + public boolean isSelected() { + return isStateSelected(); + } + } ); + + putClientProperty( FlatClientProperties.COMPONENT_FOCUS_OWNER, + (Predicate) c -> { + return ((TestStateToggleButton)c).isStateFocused(); + } ); + } + + public boolean isStateHover() { + return stateHover; + } + + public void setStateHover( boolean stateHover ) { + this.stateHover = stateHover; + } + + public boolean isStatePressed() { + return statePressed; + } + + public void setStatePressed( boolean statePressed ) { + this.statePressed = statePressed; + } + + public boolean isStateFocused() { + return stateFocused; + } + + public void setStateFocused( boolean stateFocused ) { + this.stateFocused = stateFocused; + } + + public boolean isStateSelected() { + return stateSelected; + } + + public void setStateSelected( boolean stateSelected ) { + this.stateSelected = stateSelected; + } + } + + //---- class TestDefaultButton -------------------------------------------- + + private static class TestDefaultButton + extends JButton + { + @Override + public boolean isDefaultButton() { + return true; + } + } +} diff --git a/flatlaf-theme-editor/src/main/java/com/formdev/flatlaf/themeeditor/FlatThemePreviewButtons.jfd b/flatlaf-theme-editor/src/main/java/com/formdev/flatlaf/themeeditor/FlatThemePreviewButtons.jfd new file mode 100644 index 00000000..8926f247 --- /dev/null +++ b/flatlaf-theme-editor/src/main/java/com/formdev/flatlaf/themeeditor/FlatThemePreviewButtons.jfd @@ -0,0 +1,507 @@ +JFDML JFormDesigner: "7.0.4.0.360" Java: "16" encoding: "UTF-8" + +new FormModel { + contentType: "form/swing" + root: new FormRoot { + add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) { + "$layoutConstraints": "insets dialog,hidemode 3" + "$columnConstraints": "[fill][fill][fill]para[fill][fill]para" + "$rowConstraints": "[][][][][][]unrel[]para[][][][][][]unrel[]para[][][][][][]unrel[]" + } ) { + name: "this" + add( new FormComponent( "javax.swing.JLabel" ) { + name: "label11" + "text": "JButton" + "font": &SwingDerivedFont0 new com.jformdesigner.model.SwingDerivedFont( null, 0, 4, false ) + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 0 0 3 1" + } ) + add( new FormComponent( "javax.swing.JLabel" ) { + name: "label5" + "text": "regular" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 1 1" + } ) + add( new FormComponent( "javax.swing.JLabel" ) { + name: "label7" + "text": "default" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 2 1" + } ) + add( new FormComponent( "javax.swing.JLabel" ) { + name: "label6" + "text": "focused" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 3 1" + } ) + add( new FormComponent( "javax.swing.JLabel" ) { + name: "label8" + "text": "default" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 4 1" + } ) + add( new FormComponent( "javax.swing.JLabel" ) { + name: "label1" + "text": "none" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 0 2" + } ) + add( new FormComponent( "com.formdev.flatlaf.themeeditor.FlatThemePreviewButtons$TestStateButton" ) { + name: "testStateButton1" + "text": "OK" + "$client.JComponent.minimumWidth": 0 + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 1 2" + } ) + add( new FormComponent( "com.formdev.flatlaf.themeeditor.FlatThemePreviewButtons$TestStateButton" ) { + name: "testStateButton7" + "text": "OK" + "stateDefault": true + "$client.JComponent.minimumWidth": 0 + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 2 2" + } ) + add( new FormComponent( "com.formdev.flatlaf.themeeditor.FlatThemePreviewButtons$TestStateButton" ) { + name: "testStateButton4" + "text": "OK" + "stateFocused": true + "$client.JComponent.minimumWidth": 0 + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 3 2" + } ) + add( new FormComponent( "com.formdev.flatlaf.themeeditor.FlatThemePreviewButtons$TestStateButton" ) { + name: "testStateButton10" + "text": "OK" + "stateFocused": true + "stateDefault": true + "$client.JComponent.minimumWidth": 0 + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 4 2" + } ) + add( new FormComponent( "javax.swing.JLabel" ) { + name: "label2" + "text": "hover" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 0 3" + } ) + add( new FormComponent( "com.formdev.flatlaf.themeeditor.FlatThemePreviewButtons$TestStateButton" ) { + name: "testStateButton2" + "text": "OK" + "stateHover": true + "$client.JComponent.minimumWidth": 0 + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 1 3" + } ) + add( new FormComponent( "com.formdev.flatlaf.themeeditor.FlatThemePreviewButtons$TestStateButton" ) { + name: "testStateButton8" + "text": "OK" + "stateHover": true + "stateDefault": true + "$client.JComponent.minimumWidth": 0 + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 2 3" + } ) + add( new FormComponent( "com.formdev.flatlaf.themeeditor.FlatThemePreviewButtons$TestStateButton" ) { + name: "testStateButton5" + "text": "OK" + "stateHover": true + "stateFocused": true + "$client.JComponent.minimumWidth": 0 + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 3 3" + } ) + add( new FormComponent( "com.formdev.flatlaf.themeeditor.FlatThemePreviewButtons$TestStateButton" ) { + name: "testStateButton11" + "text": "OK" + "stateHover": true + "stateFocused": true + "stateDefault": true + "$client.JComponent.minimumWidth": 0 + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 4 3" + } ) + add( new FormComponent( "javax.swing.JLabel" ) { + name: "label3" + "text": "pressed" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 0 4" + } ) + add( new FormComponent( "com.formdev.flatlaf.themeeditor.FlatThemePreviewButtons$TestStateButton" ) { + name: "testStateButton3" + "text": "OK" + "statePressed": true + "$client.JComponent.minimumWidth": 0 + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 1 4" + } ) + add( new FormComponent( "com.formdev.flatlaf.themeeditor.FlatThemePreviewButtons$TestStateButton" ) { + name: "testStateButton9" + "text": "OK" + "statePressed": true + "stateDefault": true + "$client.JComponent.minimumWidth": 0 + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 2 4" + } ) + add( new FormComponent( "com.formdev.flatlaf.themeeditor.FlatThemePreviewButtons$TestStateButton" ) { + name: "testStateButton6" + "text": "OK" + "statePressed": true + "stateFocused": true + "$client.JComponent.minimumWidth": 0 + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 3 4" + } ) + add( new FormComponent( "com.formdev.flatlaf.themeeditor.FlatThemePreviewButtons$TestStateButton" ) { + name: "testStateButton12" + "text": "OK" + "statePressed": true + "stateFocused": true + "stateDefault": true + "$client.JComponent.minimumWidth": 0 + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 4 4" + } ) + add( new FormComponent( "javax.swing.JLabel" ) { + name: "label4" + "text": "disabled" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 0 5" + } ) + add( new FormComponent( "com.formdev.flatlaf.themeeditor.FlatThemePreviewButtons$TestStateButton" ) { + name: "testStateButton13" + "text": "OK" + "enabled": false + "$client.JComponent.minimumWidth": 0 + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 1 5" + } ) + add( new FormComponent( "com.formdev.flatlaf.themeeditor.FlatThemePreviewButtons$TestStateButton" ) { + name: "testStateButton14" + "text": "OK" + "enabled": false + "stateDefault": true + "$client.JComponent.minimumWidth": 0 + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 2 5" + } ) + add( new FormComponent( "javax.swing.JLabel" ) { + name: "label10" + "text": "try me" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 0 6" + } ) + add( new FormComponent( "javax.swing.JButton" ) { + name: "button1" + "text": "OK" + "$client.JComponent.minimumWidth": 0 + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 1 6" + } ) + add( new FormComponent( "com.formdev.flatlaf.themeeditor.FlatThemePreviewButtons$TestDefaultButton" ) { + name: "testDefaultButton1" + "text": "OK" + "$client.JComponent.minimumWidth": 0 + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 2 6" + } ) + add( new FormComponent( "javax.swing.JLabel" ) { + name: "label12" + "text": "JToggleButton" + "font": #SwingDerivedFont0 + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 0 7 3 1" + } ) + add( new FormComponent( "javax.swing.JLabel" ) { + name: "label13" + "text": "unsel." + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 1 8" + } ) + add( new FormComponent( "javax.swing.JLabel" ) { + name: "label14" + "text": "selected" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 2 8" + } ) + add( new FormComponent( "javax.swing.JLabel" ) { + name: "label15" + "text": "focused" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 3 8" + } ) + add( new FormComponent( "javax.swing.JLabel" ) { + name: "label16" + "text": "selected" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 4 8" + } ) + add( new FormComponent( "javax.swing.JLabel" ) { + name: "label17" + "text": "none" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 0 9" + } ) + add( new FormComponent( "com.formdev.flatlaf.themeeditor.FlatThemePreviewButtons$TestStateToggleButton" ) { + name: "testStateToggleButton1" + "text": "OK" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 1 9" + } ) + add( new FormComponent( "com.formdev.flatlaf.themeeditor.FlatThemePreviewButtons$TestStateToggleButton" ) { + name: "testStateToggleButton5" + "text": "OK" + "stateSelected": true + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 2 9" + } ) + add( new FormComponent( "com.formdev.flatlaf.themeeditor.FlatThemePreviewButtons$TestStateToggleButton" ) { + name: "testStateToggleButton9" + "text": "OK" + "stateFocused": true + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 3 9" + } ) + add( new FormComponent( "com.formdev.flatlaf.themeeditor.FlatThemePreviewButtons$TestStateToggleButton" ) { + name: "testStateToggleButton12" + "text": "OK" + "stateSelected": true + "stateFocused": true + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 4 9" + } ) + add( new FormComponent( "javax.swing.JLabel" ) { + name: "label18" + "text": "hover" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 0 10" + } ) + add( new FormComponent( "com.formdev.flatlaf.themeeditor.FlatThemePreviewButtons$TestStateToggleButton" ) { + name: "testStateToggleButton2" + "text": "OK" + "stateHover": true + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 1 10" + } ) + add( new FormComponent( "com.formdev.flatlaf.themeeditor.FlatThemePreviewButtons$TestStateToggleButton" ) { + name: "testStateToggleButton6" + "text": "OK" + "stateHover": true + "stateSelected": true + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 2 10" + } ) + add( new FormComponent( "com.formdev.flatlaf.themeeditor.FlatThemePreviewButtons$TestStateToggleButton" ) { + name: "testStateToggleButton10" + "text": "OK" + "stateHover": true + "stateFocused": true + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 3 10" + } ) + add( new FormComponent( "com.formdev.flatlaf.themeeditor.FlatThemePreviewButtons$TestStateToggleButton" ) { + name: "testStateToggleButton13" + "text": "OK" + "stateHover": true + "stateSelected": true + "stateFocused": true + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 4 10" + } ) + add( new FormComponent( "javax.swing.JLabel" ) { + name: "label19" + "text": "pressed" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 0 11" + } ) + add( new FormComponent( "com.formdev.flatlaf.themeeditor.FlatThemePreviewButtons$TestStateToggleButton" ) { + name: "testStateToggleButton3" + "text": "OK" + "statePressed": true + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 1 11" + } ) + add( new FormComponent( "com.formdev.flatlaf.themeeditor.FlatThemePreviewButtons$TestStateToggleButton" ) { + name: "testStateToggleButton7" + "text": "OK" + "statePressed": true + "stateSelected": true + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 2 11" + } ) + add( new FormComponent( "com.formdev.flatlaf.themeeditor.FlatThemePreviewButtons$TestStateToggleButton" ) { + name: "testStateToggleButton11" + "text": "OK" + "statePressed": true + "stateFocused": true + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 3 11" + } ) + add( new FormComponent( "com.formdev.flatlaf.themeeditor.FlatThemePreviewButtons$TestStateToggleButton" ) { + name: "testStateToggleButton14" + "text": "OK" + "statePressed": true + "stateSelected": true + "stateFocused": true + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 4 11" + } ) + add( new FormComponent( "javax.swing.JLabel" ) { + name: "label20" + "text": "disabled" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 0 12" + } ) + add( new FormComponent( "com.formdev.flatlaf.themeeditor.FlatThemePreviewButtons$TestStateToggleButton" ) { + name: "testStateToggleButton4" + "text": "OK" + "enabled": false + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 1 12" + } ) + add( new FormComponent( "com.formdev.flatlaf.themeeditor.FlatThemePreviewButtons$TestStateToggleButton" ) { + name: "testStateToggleButton8" + "text": "OK" + "enabled": false + "stateSelected": true + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 2 12" + } ) + add( new FormComponent( "javax.swing.JLabel" ) { + name: "label21" + "text": "try me" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 0 13" + } ) + add( new FormComponent( "javax.swing.JToggleButton" ) { + name: "toggleButton1" + "text": "OK" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 1 13" + } ) + add( new FormComponent( "javax.swing.JToggleButton" ) { + name: "toggleButton2" + "text": "OK" + "selected": true + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 2 13" + } ) + add( new FormComponent( "javax.swing.JLabel" ) { + name: "label32" + "text": "Help Button" + "font": #SwingDerivedFont0 + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 0 14 2 1" + } ) + add( new FormComponent( "javax.swing.JLabel" ) { + name: "label9" + "text": "regular" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 1 15" + } ) + add( new FormComponent( "javax.swing.JLabel" ) { + name: "label33" + "text": "focused" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 2 15" + } ) + add( new FormComponent( "javax.swing.JLabel" ) { + name: "label22" + "text": "none" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 0 16" + } ) + add( new FormComponent( "com.formdev.flatlaf.themeeditor.FlatThemePreviewButtons$TestStateButton" ) { + name: "testStateButton15" + "$client.JComponent.minimumWidth": 0 + "$client.JButton.buttonType": "help" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 1 16" + } ) + add( new FormComponent( "com.formdev.flatlaf.themeeditor.FlatThemePreviewButtons$TestStateButton" ) { + name: "testStateButton19" + "stateFocused": true + "$client.JComponent.minimumWidth": 0 + "$client.JButton.buttonType": "help" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 2 16" + } ) + add( new FormComponent( "javax.swing.JLabel" ) { + name: "label23" + "text": "hover" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 0 17" + } ) + add( new FormComponent( "com.formdev.flatlaf.themeeditor.FlatThemePreviewButtons$TestStateButton" ) { + name: "testStateButton16" + "stateHover": true + "$client.JComponent.minimumWidth": 0 + "$client.JButton.buttonType": "help" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 1 17" + } ) + add( new FormComponent( "com.formdev.flatlaf.themeeditor.FlatThemePreviewButtons$TestStateButton" ) { + name: "testStateButton20" + "stateHover": true + "stateFocused": true + "$client.JComponent.minimumWidth": 0 + "$client.JButton.buttonType": "help" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 2 17" + } ) + add( new FormComponent( "javax.swing.JLabel" ) { + name: "label24" + "text": "pressed" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 0 18" + } ) + add( new FormComponent( "com.formdev.flatlaf.themeeditor.FlatThemePreviewButtons$TestStateButton" ) { + name: "testStateButton17" + "statePressed": true + "$client.JComponent.minimumWidth": 0 + "$client.JButton.buttonType": "help" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 1 18" + } ) + add( new FormComponent( "com.formdev.flatlaf.themeeditor.FlatThemePreviewButtons$TestStateButton" ) { + name: "testStateButton21" + "statePressed": true + "stateFocused": true + "$client.JComponent.minimumWidth": 0 + "$client.JButton.buttonType": "help" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 2 18" + } ) + add( new FormComponent( "javax.swing.JLabel" ) { + name: "label25" + "text": "disabled" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 0 19" + } ) + add( new FormComponent( "com.formdev.flatlaf.themeeditor.FlatThemePreviewButtons$TestStateButton" ) { + name: "testStateButton18" + "enabled": false + "$client.JComponent.minimumWidth": 0 + "$client.JButton.buttonType": "help" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 1 19" + } ) + add( new FormComponent( "javax.swing.JLabel" ) { + name: "label26" + "text": "try me" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 0 20" + } ) + add( new FormComponent( "javax.swing.JButton" ) { + name: "button2" + "$client.JComponent.minimumWidth": 0 + "$client.JButton.buttonType": "help" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 1 20" + } ) + }, new FormLayoutConstraints( null ) { + "location": new java.awt.Point( 0, 0 ) + "size": new java.awt.Dimension( 335, 685 ) + } ) + } +} diff --git a/flatlaf-theme-editor/src/main/java/com/formdev/flatlaf/themeeditor/FlatThemePreviewSwitches.java b/flatlaf-theme-editor/src/main/java/com/formdev/flatlaf/themeeditor/FlatThemePreviewSwitches.java new file mode 100644 index 00000000..4d30fac8 --- /dev/null +++ b/flatlaf-theme-editor/src/main/java/com/formdev/flatlaf/themeeditor/FlatThemePreviewSwitches.java @@ -0,0 +1,558 @@ +/* + * Copyright 2021 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.themeeditor; + +import java.util.function.Predicate; +import javax.swing.*; +import com.formdev.flatlaf.FlatClientProperties; +import net.miginfocom.swing.*; + +/** + * @author Karl Tauber + */ +class FlatThemePreviewSwitches + extends JPanel +{ + FlatThemePreviewSwitches() { + initComponents(); + } + + private void initComponents() { + // JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents + label22 = new JLabel(); + label23 = new JLabel(); + label28 = new JLabel(); + label24 = new JLabel(); + label29 = new JLabel(); + label17 = new JLabel(); + testStateCheckBox1 = new FlatThemePreviewSwitches.TestStateCheckBox(); + testStateCheckBox8 = new FlatThemePreviewSwitches.TestStateCheckBox(); + testStateCheckBox5 = new FlatThemePreviewSwitches.TestStateCheckBox(); + testStateCheckBox12 = new FlatThemePreviewSwitches.TestStateCheckBox(); + label18 = new JLabel(); + testStateCheckBox2 = new FlatThemePreviewSwitches.TestStateCheckBox(); + testStateCheckBox9 = new FlatThemePreviewSwitches.TestStateCheckBox(); + testStateCheckBox6 = new FlatThemePreviewSwitches.TestStateCheckBox(); + testStateCheckBox13 = new FlatThemePreviewSwitches.TestStateCheckBox(); + label19 = new JLabel(); + testStateCheckBox3 = new FlatThemePreviewSwitches.TestStateCheckBox(); + testStateCheckBox10 = new FlatThemePreviewSwitches.TestStateCheckBox(); + testStateCheckBox7 = new FlatThemePreviewSwitches.TestStateCheckBox(); + testStateCheckBox14 = new FlatThemePreviewSwitches.TestStateCheckBox(); + label20 = new JLabel(); + testStateCheckBox4 = new FlatThemePreviewSwitches.TestStateCheckBox(); + testStateCheckBox11 = new FlatThemePreviewSwitches.TestStateCheckBox(); + label21 = new JLabel(); + checkBox1 = new JCheckBox(); + checkBox2 = new JCheckBox(); + label27 = new JLabel(); + label25 = new JLabel(); + label30 = new JLabel(); + label26 = new JLabel(); + label31 = new JLabel(); + label36 = new JLabel(); + testStateRadioButton1 = new FlatThemePreviewSwitches.TestStateRadioButton(); + testStateRadioButton8 = new FlatThemePreviewSwitches.TestStateRadioButton(); + testStateRadioButton5 = new FlatThemePreviewSwitches.TestStateRadioButton(); + testStateRadioButton9 = new FlatThemePreviewSwitches.TestStateRadioButton(); + label35 = new JLabel(); + testStateRadioButton2 = new FlatThemePreviewSwitches.TestStateRadioButton(); + testStateRadioButton10 = new FlatThemePreviewSwitches.TestStateRadioButton(); + testStateRadioButton6 = new FlatThemePreviewSwitches.TestStateRadioButton(); + testStateRadioButton11 = new FlatThemePreviewSwitches.TestStateRadioButton(); + label34 = new JLabel(); + testStateRadioButton3 = new FlatThemePreviewSwitches.TestStateRadioButton(); + testStateRadioButton12 = new FlatThemePreviewSwitches.TestStateRadioButton(); + testStateRadioButton7 = new FlatThemePreviewSwitches.TestStateRadioButton(); + testStateRadioButton13 = new FlatThemePreviewSwitches.TestStateRadioButton(); + label33 = new JLabel(); + testStateRadioButton4 = new FlatThemePreviewSwitches.TestStateRadioButton(); + testStateRadioButton14 = new FlatThemePreviewSwitches.TestStateRadioButton(); + label32 = new JLabel(); + radioButton1 = new JRadioButton(); + radioButton2 = new JRadioButton(); + + //======== this ======== + setLayout(new MigLayout( + "insets dialog,hidemode 3", + // columns + "[fill]" + + "[fill]" + + "[fill]para" + + "[fill]" + + "[fill]para", + // rows + "[]" + + "[]" + + "[]" + + "[]" + + "[]" + + "[]unrel" + + "[]para" + + "[]" + + "[]" + + "[]" + + "[]" + + "[]" + + "[]unrel" + + "[]")); + + //---- label22 ---- + label22.setText("JCheckBox"); + label22.setFont(label22.getFont().deriveFont(label22.getFont().getSize() + 4f)); + add(label22, "cell 0 0 3 1"); + + //---- label23 ---- + label23.setText("unsel."); + add(label23, "cell 1 1"); + + //---- label28 ---- + label28.setText("selected"); + add(label28, "cell 2 1"); + + //---- label24 ---- + label24.setText("focused"); + add(label24, "cell 3 1"); + + //---- label29 ---- + label29.setText("selected"); + add(label29, "cell 4 1"); + + //---- label17 ---- + label17.setText("none"); + add(label17, "cell 0 2"); + + //---- testStateCheckBox1 ---- + testStateCheckBox1.setText("text"); + add(testStateCheckBox1, "cell 1 2"); + + //---- testStateCheckBox8 ---- + testStateCheckBox8.setText("text"); + testStateCheckBox8.setStateSelected(true); + add(testStateCheckBox8, "cell 2 2"); + + //---- testStateCheckBox5 ---- + testStateCheckBox5.setText("text"); + testStateCheckBox5.setStateFocused(true); + add(testStateCheckBox5, "cell 3 2"); + + //---- testStateCheckBox12 ---- + testStateCheckBox12.setText("text"); + testStateCheckBox12.setStateFocused(true); + testStateCheckBox12.setStateSelected(true); + add(testStateCheckBox12, "cell 4 2"); + + //---- label18 ---- + label18.setText("hover"); + add(label18, "cell 0 3"); + + //---- testStateCheckBox2 ---- + testStateCheckBox2.setText("text"); + testStateCheckBox2.setStateHover(true); + add(testStateCheckBox2, "cell 1 3"); + + //---- testStateCheckBox9 ---- + testStateCheckBox9.setText("text"); + testStateCheckBox9.setStateHover(true); + testStateCheckBox9.setStateSelected(true); + add(testStateCheckBox9, "cell 2 3"); + + //---- testStateCheckBox6 ---- + testStateCheckBox6.setText("text"); + testStateCheckBox6.setStateFocused(true); + testStateCheckBox6.setStateHover(true); + add(testStateCheckBox6, "cell 3 3"); + + //---- testStateCheckBox13 ---- + testStateCheckBox13.setText("text"); + testStateCheckBox13.setStateFocused(true); + testStateCheckBox13.setStateHover(true); + testStateCheckBox13.setStateSelected(true); + add(testStateCheckBox13, "cell 4 3"); + + //---- label19 ---- + label19.setText("pressed"); + add(label19, "cell 0 4"); + + //---- testStateCheckBox3 ---- + testStateCheckBox3.setText("text"); + testStateCheckBox3.setStatePressed(true); + add(testStateCheckBox3, "cell 1 4"); + + //---- testStateCheckBox10 ---- + testStateCheckBox10.setText("text"); + testStateCheckBox10.setStatePressed(true); + testStateCheckBox10.setStateSelected(true); + add(testStateCheckBox10, "cell 2 4"); + + //---- testStateCheckBox7 ---- + testStateCheckBox7.setText("text"); + testStateCheckBox7.setStateFocused(true); + testStateCheckBox7.setStatePressed(true); + add(testStateCheckBox7, "cell 3 4"); + + //---- testStateCheckBox14 ---- + testStateCheckBox14.setText("text"); + testStateCheckBox14.setStateFocused(true); + testStateCheckBox14.setStatePressed(true); + testStateCheckBox14.setStateSelected(true); + add(testStateCheckBox14, "cell 4 4"); + + //---- label20 ---- + label20.setText("disabled"); + add(label20, "cell 0 5"); + + //---- testStateCheckBox4 ---- + testStateCheckBox4.setText("text"); + testStateCheckBox4.setEnabled(false); + add(testStateCheckBox4, "cell 1 5"); + + //---- testStateCheckBox11 ---- + testStateCheckBox11.setText("text"); + testStateCheckBox11.setEnabled(false); + testStateCheckBox11.setStateSelected(true); + add(testStateCheckBox11, "cell 2 5"); + + //---- label21 ---- + label21.setText("try me"); + add(label21, "cell 0 6"); + + //---- checkBox1 ---- + checkBox1.setText("text"); + add(checkBox1, "cell 1 6"); + + //---- checkBox2 ---- + checkBox2.setText("text"); + checkBox2.setSelected(true); + add(checkBox2, "cell 2 6"); + + //---- label27 ---- + label27.setText("JRadioButton"); + label27.setFont(label27.getFont().deriveFont(label27.getFont().getSize() + 4f)); + add(label27, "cell 0 7 3 1"); + + //---- label25 ---- + label25.setText("unsel."); + add(label25, "cell 1 8"); + + //---- label30 ---- + label30.setText("selected"); + add(label30, "cell 2 8"); + + //---- label26 ---- + label26.setText("focused"); + add(label26, "cell 3 8"); + + //---- label31 ---- + label31.setText("selected"); + add(label31, "cell 4 8"); + + //---- label36 ---- + label36.setText("none"); + add(label36, "cell 0 9"); + + //---- testStateRadioButton1 ---- + testStateRadioButton1.setText("text"); + add(testStateRadioButton1, "cell 1 9"); + + //---- testStateRadioButton8 ---- + testStateRadioButton8.setText("text"); + testStateRadioButton8.setStateSelected(true); + add(testStateRadioButton8, "cell 2 9"); + + //---- testStateRadioButton5 ---- + testStateRadioButton5.setText("text"); + testStateRadioButton5.setStateFocused(true); + add(testStateRadioButton5, "cell 3 9"); + + //---- testStateRadioButton9 ---- + testStateRadioButton9.setText("text"); + testStateRadioButton9.setStateFocused(true); + testStateRadioButton9.setStateSelected(true); + add(testStateRadioButton9, "cell 4 9"); + + //---- label35 ---- + label35.setText("hover"); + add(label35, "cell 0 10"); + + //---- testStateRadioButton2 ---- + testStateRadioButton2.setText("text"); + testStateRadioButton2.setStateHover(true); + add(testStateRadioButton2, "cell 1 10"); + + //---- testStateRadioButton10 ---- + testStateRadioButton10.setText("text"); + testStateRadioButton10.setStateHover(true); + testStateRadioButton10.setStateSelected(true); + add(testStateRadioButton10, "cell 2 10"); + + //---- testStateRadioButton6 ---- + testStateRadioButton6.setText("text"); + testStateRadioButton6.setStateFocused(true); + testStateRadioButton6.setStateHover(true); + add(testStateRadioButton6, "cell 3 10"); + + //---- testStateRadioButton11 ---- + testStateRadioButton11.setText("text"); + testStateRadioButton11.setStateFocused(true); + testStateRadioButton11.setStateHover(true); + testStateRadioButton11.setStateSelected(true); + add(testStateRadioButton11, "cell 4 10"); + + //---- label34 ---- + label34.setText("pressed"); + add(label34, "cell 0 11"); + + //---- testStateRadioButton3 ---- + testStateRadioButton3.setText("text"); + testStateRadioButton3.setStatePressed(true); + add(testStateRadioButton3, "cell 1 11"); + + //---- testStateRadioButton12 ---- + testStateRadioButton12.setText("text"); + testStateRadioButton12.setStatePressed(true); + testStateRadioButton12.setStateSelected(true); + add(testStateRadioButton12, "cell 2 11"); + + //---- testStateRadioButton7 ---- + testStateRadioButton7.setText("text"); + testStateRadioButton7.setStateFocused(true); + testStateRadioButton7.setStatePressed(true); + add(testStateRadioButton7, "cell 3 11"); + + //---- testStateRadioButton13 ---- + testStateRadioButton13.setText("text"); + testStateRadioButton13.setStateFocused(true); + testStateRadioButton13.setStatePressed(true); + testStateRadioButton13.setStateSelected(true); + add(testStateRadioButton13, "cell 4 11"); + + //---- label33 ---- + label33.setText("disabled"); + add(label33, "cell 0 12"); + + //---- testStateRadioButton4 ---- + testStateRadioButton4.setText("text"); + testStateRadioButton4.setEnabled(false); + add(testStateRadioButton4, "cell 1 12"); + + //---- testStateRadioButton14 ---- + testStateRadioButton14.setText("text"); + testStateRadioButton14.setEnabled(false); + testStateRadioButton14.setStateSelected(true); + add(testStateRadioButton14, "cell 2 12"); + + //---- label32 ---- + label32.setText("try me"); + add(label32, "cell 0 13"); + + //---- radioButton1 ---- + radioButton1.setText("text"); + add(radioButton1, "cell 1 13"); + + //---- radioButton2 ---- + radioButton2.setText("text"); + radioButton2.setSelected(true); + add(radioButton2, "cell 2 13"); + // JFormDesigner - End of component initialization //GEN-END:initComponents + } + + // JFormDesigner - Variables declaration - DO NOT MODIFY //GEN-BEGIN:variables + private JLabel label22; + private JLabel label23; + private JLabel label28; + private JLabel label24; + private JLabel label29; + private JLabel label17; + private FlatThemePreviewSwitches.TestStateCheckBox testStateCheckBox1; + private FlatThemePreviewSwitches.TestStateCheckBox testStateCheckBox8; + private FlatThemePreviewSwitches.TestStateCheckBox testStateCheckBox5; + private FlatThemePreviewSwitches.TestStateCheckBox testStateCheckBox12; + private JLabel label18; + private FlatThemePreviewSwitches.TestStateCheckBox testStateCheckBox2; + private FlatThemePreviewSwitches.TestStateCheckBox testStateCheckBox9; + private FlatThemePreviewSwitches.TestStateCheckBox testStateCheckBox6; + private FlatThemePreviewSwitches.TestStateCheckBox testStateCheckBox13; + private JLabel label19; + private FlatThemePreviewSwitches.TestStateCheckBox testStateCheckBox3; + private FlatThemePreviewSwitches.TestStateCheckBox testStateCheckBox10; + private FlatThemePreviewSwitches.TestStateCheckBox testStateCheckBox7; + private FlatThemePreviewSwitches.TestStateCheckBox testStateCheckBox14; + private JLabel label20; + private FlatThemePreviewSwitches.TestStateCheckBox testStateCheckBox4; + private FlatThemePreviewSwitches.TestStateCheckBox testStateCheckBox11; + private JLabel label21; + private JCheckBox checkBox1; + private JCheckBox checkBox2; + private JLabel label27; + private JLabel label25; + private JLabel label30; + private JLabel label26; + private JLabel label31; + private JLabel label36; + private FlatThemePreviewSwitches.TestStateRadioButton testStateRadioButton1; + private FlatThemePreviewSwitches.TestStateRadioButton testStateRadioButton8; + private FlatThemePreviewSwitches.TestStateRadioButton testStateRadioButton5; + private FlatThemePreviewSwitches.TestStateRadioButton testStateRadioButton9; + private JLabel label35; + private FlatThemePreviewSwitches.TestStateRadioButton testStateRadioButton2; + private FlatThemePreviewSwitches.TestStateRadioButton testStateRadioButton10; + private FlatThemePreviewSwitches.TestStateRadioButton testStateRadioButton6; + private FlatThemePreviewSwitches.TestStateRadioButton testStateRadioButton11; + private JLabel label34; + private FlatThemePreviewSwitches.TestStateRadioButton testStateRadioButton3; + private FlatThemePreviewSwitches.TestStateRadioButton testStateRadioButton12; + private FlatThemePreviewSwitches.TestStateRadioButton testStateRadioButton7; + private FlatThemePreviewSwitches.TestStateRadioButton testStateRadioButton13; + private JLabel label33; + private FlatThemePreviewSwitches.TestStateRadioButton testStateRadioButton4; + private FlatThemePreviewSwitches.TestStateRadioButton testStateRadioButton14; + private JLabel label32; + private JRadioButton radioButton1; + private JRadioButton radioButton2; + // JFormDesigner - End of variables declaration //GEN-END:variables + + //---- class TestStateCheckBox -------------------------------------------- + + private static class TestStateCheckBox + extends JCheckBox + { + private boolean stateHover; + private boolean statePressed; + private boolean stateFocused; + private boolean stateSelected; + + public TestStateCheckBox() { + setModel( new DefaultButtonModel() { + @Override + public boolean isRollover() { + return isStateHover(); + } + @Override + public boolean isPressed() { + return isStatePressed(); + } + @Override + public boolean isSelected() { + return isStateSelected(); + } + } ); + + putClientProperty( FlatClientProperties.COMPONENT_FOCUS_OWNER, + (Predicate) c -> { + return ((TestStateCheckBox)c).isStateFocused(); + } ); + } + + public boolean isStateHover() { + return stateHover; + } + + public void setStateHover( boolean stateHover ) { + this.stateHover = stateHover; + } + + public boolean isStatePressed() { + return statePressed; + } + + public void setStatePressed( boolean statePressed ) { + this.statePressed = statePressed; + } + + public boolean isStateFocused() { + return stateFocused; + } + + public void setStateFocused( boolean stateFocused ) { + this.stateFocused = stateFocused; + } + + public boolean isStateSelected() { + return stateSelected; + } + + public void setStateSelected( boolean stateSelected ) { + this.stateSelected = stateSelected; + } + } + + //---- class TestStateRadioButton ----------------------------------------- + + private static class TestStateRadioButton + extends JRadioButton + { + private boolean stateHover; + private boolean statePressed; + private boolean stateFocused; + private boolean stateSelected; + + public TestStateRadioButton() { + setModel( new DefaultButtonModel() { + @Override + public boolean isRollover() { + return isStateHover(); + } + @Override + public boolean isPressed() { + return isStatePressed(); + } + @Override + public boolean isSelected() { + return isStateSelected(); + } + } ); + + putClientProperty( FlatClientProperties.COMPONENT_FOCUS_OWNER, + (Predicate) c -> { + return ((TestStateRadioButton)c).isStateFocused(); + } ); + } + + public boolean isStateHover() { + return stateHover; + } + + public void setStateHover( boolean stateHover ) { + this.stateHover = stateHover; + } + + public boolean isStatePressed() { + return statePressed; + } + + public void setStatePressed( boolean statePressed ) { + this.statePressed = statePressed; + } + + public boolean isStateFocused() { + return stateFocused; + } + + public void setStateFocused( boolean stateFocused ) { + this.stateFocused = stateFocused; + } + + public boolean isStateSelected() { + return stateSelected; + } + + public void setStateSelected( boolean stateSelected ) { + this.stateSelected = stateSelected; + } + } +} diff --git a/flatlaf-theme-editor/src/main/java/com/formdev/flatlaf/themeeditor/FlatThemePreviewSwitches.jfd b/flatlaf-theme-editor/src/main/java/com/formdev/flatlaf/themeeditor/FlatThemePreviewSwitches.jfd new file mode 100644 index 00000000..819e9be7 --- /dev/null +++ b/flatlaf-theme-editor/src/main/java/com/formdev/flatlaf/themeeditor/FlatThemePreviewSwitches.jfd @@ -0,0 +1,379 @@ +JFDML JFormDesigner: "7.0.4.0.360" Java: "16" encoding: "UTF-8" + +new FormModel { + contentType: "form/swing" + root: new FormRoot { + add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) { + "$layoutConstraints": "insets dialog,hidemode 3" + "$columnConstraints": "[fill][fill][fill]para[fill][fill]para" + "$rowConstraints": "[][][][][][]unrel[]para[][][][][][]unrel[]" + } ) { + name: "this" + add( new FormComponent( "javax.swing.JLabel" ) { + name: "label22" + "text": "JCheckBox" + "font": &SwingDerivedFont0 new com.jformdesigner.model.SwingDerivedFont( null, 0, 4, false ) + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 0 0 3 1" + } ) + add( new FormComponent( "javax.swing.JLabel" ) { + name: "label23" + "text": "unsel." + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 1 1" + } ) + add( new FormComponent( "javax.swing.JLabel" ) { + name: "label28" + "text": "selected" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 2 1" + } ) + add( new FormComponent( "javax.swing.JLabel" ) { + name: "label24" + "text": "focused" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 3 1" + } ) + add( new FormComponent( "javax.swing.JLabel" ) { + name: "label29" + "text": "selected" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 4 1" + } ) + add( new FormComponent( "javax.swing.JLabel" ) { + name: "label17" + "text": "none" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 0 2" + } ) + add( new FormComponent( "com.formdev.flatlaf.themeeditor.FlatThemePreviewSwitches$TestStateCheckBox" ) { + name: "testStateCheckBox1" + "text": "text" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 1 2" + } ) + add( new FormComponent( "com.formdev.flatlaf.themeeditor.FlatThemePreviewSwitches$TestStateCheckBox" ) { + name: "testStateCheckBox8" + "text": "text" + "stateSelected": true + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 2 2" + } ) + add( new FormComponent( "com.formdev.flatlaf.themeeditor.FlatThemePreviewSwitches$TestStateCheckBox" ) { + name: "testStateCheckBox5" + "text": "text" + "stateFocused": true + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 3 2" + } ) + add( new FormComponent( "com.formdev.flatlaf.themeeditor.FlatThemePreviewSwitches$TestStateCheckBox" ) { + name: "testStateCheckBox12" + "text": "text" + "stateFocused": true + "stateSelected": true + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 4 2" + } ) + add( new FormComponent( "javax.swing.JLabel" ) { + name: "label18" + "text": "hover" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 0 3" + } ) + add( new FormComponent( "com.formdev.flatlaf.themeeditor.FlatThemePreviewSwitches$TestStateCheckBox" ) { + name: "testStateCheckBox2" + "text": "text" + "stateHover": true + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 1 3" + } ) + add( new FormComponent( "com.formdev.flatlaf.themeeditor.FlatThemePreviewSwitches$TestStateCheckBox" ) { + name: "testStateCheckBox9" + "text": "text" + "stateHover": true + "stateSelected": true + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 2 3" + } ) + add( new FormComponent( "com.formdev.flatlaf.themeeditor.FlatThemePreviewSwitches$TestStateCheckBox" ) { + name: "testStateCheckBox6" + "text": "text" + "stateFocused": true + "stateHover": true + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 3 3" + } ) + add( new FormComponent( "com.formdev.flatlaf.themeeditor.FlatThemePreviewSwitches$TestStateCheckBox" ) { + name: "testStateCheckBox13" + "text": "text" + "stateFocused": true + "stateHover": true + "stateSelected": true + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 4 3" + } ) + add( new FormComponent( "javax.swing.JLabel" ) { + name: "label19" + "text": "pressed" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 0 4" + } ) + add( new FormComponent( "com.formdev.flatlaf.themeeditor.FlatThemePreviewSwitches$TestStateCheckBox" ) { + name: "testStateCheckBox3" + "text": "text" + "statePressed": true + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 1 4" + } ) + add( new FormComponent( "com.formdev.flatlaf.themeeditor.FlatThemePreviewSwitches$TestStateCheckBox" ) { + name: "testStateCheckBox10" + "text": "text" + "statePressed": true + "stateSelected": true + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 2 4" + } ) + add( new FormComponent( "com.formdev.flatlaf.themeeditor.FlatThemePreviewSwitches$TestStateCheckBox" ) { + name: "testStateCheckBox7" + "text": "text" + "stateFocused": true + "statePressed": true + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 3 4" + } ) + add( new FormComponent( "com.formdev.flatlaf.themeeditor.FlatThemePreviewSwitches$TestStateCheckBox" ) { + name: "testStateCheckBox14" + "text": "text" + "stateFocused": true + "statePressed": true + "stateSelected": true + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 4 4" + } ) + add( new FormComponent( "javax.swing.JLabel" ) { + name: "label20" + "text": "disabled" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 0 5" + } ) + add( new FormComponent( "com.formdev.flatlaf.themeeditor.FlatThemePreviewSwitches$TestStateCheckBox" ) { + name: "testStateCheckBox4" + "text": "text" + "enabled": false + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 1 5" + } ) + add( new FormComponent( "com.formdev.flatlaf.themeeditor.FlatThemePreviewSwitches$TestStateCheckBox" ) { + name: "testStateCheckBox11" + "text": "text" + "enabled": false + "stateSelected": true + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 2 5" + } ) + add( new FormComponent( "javax.swing.JLabel" ) { + name: "label21" + "text": "try me" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 0 6" + } ) + add( new FormComponent( "javax.swing.JCheckBox" ) { + name: "checkBox1" + "text": "text" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 1 6" + } ) + add( new FormComponent( "javax.swing.JCheckBox" ) { + name: "checkBox2" + "text": "text" + "selected": true + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 2 6" + } ) + add( new FormComponent( "javax.swing.JLabel" ) { + name: "label27" + "text": "JRadioButton" + "font": #SwingDerivedFont0 + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 0 7 3 1" + } ) + add( new FormComponent( "javax.swing.JLabel" ) { + name: "label25" + "text": "unsel." + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 1 8" + } ) + add( new FormComponent( "javax.swing.JLabel" ) { + name: "label30" + "text": "selected" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 2 8" + } ) + add( new FormComponent( "javax.swing.JLabel" ) { + name: "label26" + "text": "focused" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 3 8" + } ) + add( new FormComponent( "javax.swing.JLabel" ) { + name: "label31" + "text": "selected" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 4 8" + } ) + add( new FormComponent( "javax.swing.JLabel" ) { + name: "label36" + "text": "none" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 0 9" + } ) + add( new FormComponent( "com.formdev.flatlaf.themeeditor.FlatThemePreviewSwitches$TestStateRadioButton" ) { + name: "testStateRadioButton1" + "text": "text" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 1 9" + } ) + add( new FormComponent( "com.formdev.flatlaf.themeeditor.FlatThemePreviewSwitches$TestStateRadioButton" ) { + name: "testStateRadioButton8" + "text": "text" + "stateSelected": true + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 2 9" + } ) + add( new FormComponent( "com.formdev.flatlaf.themeeditor.FlatThemePreviewSwitches$TestStateRadioButton" ) { + name: "testStateRadioButton5" + "text": "text" + "stateFocused": true + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 3 9" + } ) + add( new FormComponent( "com.formdev.flatlaf.themeeditor.FlatThemePreviewSwitches$TestStateRadioButton" ) { + name: "testStateRadioButton9" + "text": "text" + "stateFocused": true + "stateSelected": true + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 4 9" + } ) + add( new FormComponent( "javax.swing.JLabel" ) { + name: "label35" + "text": "hover" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 0 10" + } ) + add( new FormComponent( "com.formdev.flatlaf.themeeditor.FlatThemePreviewSwitches$TestStateRadioButton" ) { + name: "testStateRadioButton2" + "text": "text" + "stateHover": true + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 1 10" + } ) + add( new FormComponent( "com.formdev.flatlaf.themeeditor.FlatThemePreviewSwitches$TestStateRadioButton" ) { + name: "testStateRadioButton10" + "text": "text" + "stateHover": true + "stateSelected": true + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 2 10" + } ) + add( new FormComponent( "com.formdev.flatlaf.themeeditor.FlatThemePreviewSwitches$TestStateRadioButton" ) { + name: "testStateRadioButton6" + "text": "text" + "stateFocused": true + "stateHover": true + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 3 10" + } ) + add( new FormComponent( "com.formdev.flatlaf.themeeditor.FlatThemePreviewSwitches$TestStateRadioButton" ) { + name: "testStateRadioButton11" + "text": "text" + "stateFocused": true + "stateHover": true + "stateSelected": true + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 4 10" + } ) + add( new FormComponent( "javax.swing.JLabel" ) { + name: "label34" + "text": "pressed" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 0 11" + } ) + add( new FormComponent( "com.formdev.flatlaf.themeeditor.FlatThemePreviewSwitches$TestStateRadioButton" ) { + name: "testStateRadioButton3" + "text": "text" + "statePressed": true + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 1 11" + } ) + add( new FormComponent( "com.formdev.flatlaf.themeeditor.FlatThemePreviewSwitches$TestStateRadioButton" ) { + name: "testStateRadioButton12" + "text": "text" + "statePressed": true + "stateSelected": true + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 2 11" + } ) + add( new FormComponent( "com.formdev.flatlaf.themeeditor.FlatThemePreviewSwitches$TestStateRadioButton" ) { + name: "testStateRadioButton7" + "text": "text" + "stateFocused": true + "statePressed": true + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 3 11" + } ) + add( new FormComponent( "com.formdev.flatlaf.themeeditor.FlatThemePreviewSwitches$TestStateRadioButton" ) { + name: "testStateRadioButton13" + "text": "text" + "stateFocused": true + "statePressed": true + "stateSelected": true + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 4 11" + } ) + add( new FormComponent( "javax.swing.JLabel" ) { + name: "label33" + "text": "disabled" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 0 12" + } ) + add( new FormComponent( "com.formdev.flatlaf.themeeditor.FlatThemePreviewSwitches$TestStateRadioButton" ) { + name: "testStateRadioButton4" + "text": "text" + "enabled": false + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 1 12" + } ) + add( new FormComponent( "com.formdev.flatlaf.themeeditor.FlatThemePreviewSwitches$TestStateRadioButton" ) { + name: "testStateRadioButton14" + "text": "text" + "enabled": false + "stateSelected": true + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 2 12" + } ) + add( new FormComponent( "javax.swing.JLabel" ) { + name: "label32" + "text": "try me" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 0 13" + } ) + add( new FormComponent( "javax.swing.JRadioButton" ) { + name: "radioButton1" + "text": "text" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 1 13" + } ) + add( new FormComponent( "javax.swing.JRadioButton" ) { + name: "radioButton2" + "text": "text" + "selected": true + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 2 13" + } ) + }, new FormLayoutConstraints( null ) { + "location": new java.awt.Point( 0, 0 ) + "size": new java.awt.Dimension( 325, 685 ) + } ) + } +}