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 index 8c4f08a9..5e1cddeb 100644 --- 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 @@ -31,7 +31,9 @@ import javax.swing.tree.DefaultMutableTreeNode; import javax.swing.tree.DefaultTreeModel; import com.formdev.flatlaf.FlatClientProperties; import com.formdev.flatlaf.FlatLaf; +import com.formdev.flatlaf.extras.FlatSVGIcon; import com.formdev.flatlaf.extras.components.*; +import com.formdev.flatlaf.icons.FlatSearchWithHistoryIcon; import com.formdev.flatlaf.ui.FlatTabbedPaneUI; import net.miginfocom.swing.*; @@ -53,6 +55,28 @@ class FlatThemePreviewAll initComponents(); + textField2.setLeadingComponent( new JButton( new FlatSearchWithHistoryIcon( true ) ) ); + + // whole words button + JToggleButton wordsButton = new JToggleButton( new FlatSVGIcon( "com/formdev/flatlaf/themeeditor/icons/preview/words.svg" ) ); + wordsButton.setRolloverIcon( new FlatSVGIcon( "com/formdev/flatlaf/themeeditor/icons/preview/wordsHovered.svg" ) ); + wordsButton.setSelectedIcon( new FlatSVGIcon( "com/formdev/flatlaf/themeeditor/icons/preview/wordsSelected.svg" ) ); + wordsButton.setToolTipText( "Whole Words" ); + + // regex button + JToggleButton regexButton = new JToggleButton( new FlatSVGIcon( "com/formdev/flatlaf/themeeditor/icons/preview/regex.svg" ) ); + regexButton.setRolloverIcon( new FlatSVGIcon( "com/formdev/flatlaf/themeeditor/icons/preview/regexHovered.svg" ) ); + regexButton.setSelectedIcon( new FlatSVGIcon( "com/formdev/flatlaf/themeeditor/icons/preview/regexSelected.svg" ) ); + regexButton.setSelected( true ); + regexButton.setToolTipText( "Regular Expression" ); + + // search toolbar + JToolBar searchToolbar = new JToolBar(); + searchToolbar.add( wordsButton ); + searchToolbar.addSeparator(); + searchToolbar.add( regexButton ); + textField2.setTrailingComponent( searchToolbar ); + tabbedPane1.uiDefaultsGetter = preview::getUIDefaultProperty; tabbedPane1.setTabLayoutPolicy( JTabbedPane.SCROLL_TAB_LAYOUT ); tabbedPane1.addTab( "Tab 1", null ); @@ -159,6 +183,7 @@ class FlatThemePreviewAll preview.runWithUIDefaultsGetter( () -> { textField1.setEditable( editable ); + textField2.setEditable( editable ); formattedTextField1.setEditable( editable ); passwordField1.setEditable( editable ); textArea1.setEditable( editable ); @@ -266,6 +291,7 @@ class FlatThemePreviewAll JSpinner spinner1 = new JSpinner(); JLabel textFieldLabel = new JLabel(); textField1 = new FlatTextField(); + textField2 = new FlatTextField(); formattedTextField1 = new FlatFormattedTextField(); passwordField1 = new FlatPasswordField(); JLabel textAreaLabel = new JLabel(); @@ -516,7 +542,12 @@ class FlatThemePreviewAll textField1.setText("Some Text"); textField1.setPlaceholderText("placeholder text"); textField1.putClientProperty("FlatLaf.styleClass", "flatlaf-preview-textfield"); - add(textField1, "cell 1 8 2 1"); + add(textField1, "cell 1 8"); + + //---- textField2 ---- + textField2.setText("Txt"); + textField2.putClientProperty("FlatLaf.styleClass", "flatlaf-preview-textfield"); + add(textField2, "cell 2 8"); //---- formattedTextField1 ---- formattedTextField1.setText("Some Text"); @@ -528,6 +559,7 @@ class FlatThemePreviewAll passwordField1.setText("Some Text"); passwordField1.setPlaceholderText("placeholder text"); passwordField1.putClientProperty("FlatLaf.styleClass", "flatlaf-preview-passwordfield"); + passwordField1.setShowClearButton(true); add(passwordField1, "cell 2 9"); //---- textAreaLabel ---- @@ -926,6 +958,7 @@ class FlatThemePreviewAll private JCheckBox focusedCheckBox; private JLabel label1; private FlatTextField textField1; + private FlatTextField textField2; private FlatFormattedTextField formattedTextField1; private FlatPasswordField passwordField1; private JTextArea textArea1; 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 index 861fcc23..b3598d78 100644 --- 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 @@ -240,7 +240,17 @@ new FormModel { "JavaCodeGenerator.variableLocal": false } }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { - "value": "cell 1 8 2 1" + "value": "cell 1 8" + } ) + add( new FormComponent( "com.formdev.flatlaf.extras.components.FlatTextField" ) { + name: "textField2" + "text": "Txt" + "$client.FlatLaf.styleClass": "flatlaf-preview-textfield" + auxiliary() { + "JavaCodeGenerator.variableLocal": false + } + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 2 8" } ) add( new FormComponent( "com.formdev.flatlaf.extras.components.FlatFormattedTextField" ) { name: "formattedTextField1" @@ -258,6 +268,7 @@ new FormModel { "text": "Some Text" "placeholderText": "placeholder text" "$client.FlatLaf.styleClass": "flatlaf-preview-passwordfield" + "showClearButton": true auxiliary() { "JavaCodeGenerator.variableLocal": false } diff --git a/flatlaf-theme-editor/src/main/resources/com/formdev/flatlaf/themeeditor/icons/preview/regex.svg b/flatlaf-theme-editor/src/main/resources/com/formdev/flatlaf/themeeditor/icons/preview/regex.svg new file mode 100644 index 00000000..f073c590 --- /dev/null +++ b/flatlaf-theme-editor/src/main/resources/com/formdev/flatlaf/themeeditor/icons/preview/regex.svg @@ -0,0 +1,7 @@ + + + + + + + diff --git a/flatlaf-theme-editor/src/main/resources/com/formdev/flatlaf/themeeditor/icons/preview/regexHovered.svg b/flatlaf-theme-editor/src/main/resources/com/formdev/flatlaf/themeeditor/icons/preview/regexHovered.svg new file mode 100644 index 00000000..545853d7 --- /dev/null +++ b/flatlaf-theme-editor/src/main/resources/com/formdev/flatlaf/themeeditor/icons/preview/regexHovered.svg @@ -0,0 +1,7 @@ + + + + + + + diff --git a/flatlaf-theme-editor/src/main/resources/com/formdev/flatlaf/themeeditor/icons/preview/regexSelected.svg b/flatlaf-theme-editor/src/main/resources/com/formdev/flatlaf/themeeditor/icons/preview/regexSelected.svg new file mode 100644 index 00000000..29a9c56d --- /dev/null +++ b/flatlaf-theme-editor/src/main/resources/com/formdev/flatlaf/themeeditor/icons/preview/regexSelected.svg @@ -0,0 +1,7 @@ + + + + + + + diff --git a/flatlaf-theme-editor/src/main/resources/com/formdev/flatlaf/themeeditor/icons/preview/words.svg b/flatlaf-theme-editor/src/main/resources/com/formdev/flatlaf/themeeditor/icons/preview/words.svg new file mode 100644 index 00000000..e427f911 --- /dev/null +++ b/flatlaf-theme-editor/src/main/resources/com/formdev/flatlaf/themeeditor/icons/preview/words.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/flatlaf-theme-editor/src/main/resources/com/formdev/flatlaf/themeeditor/icons/preview/wordsHovered.svg b/flatlaf-theme-editor/src/main/resources/com/formdev/flatlaf/themeeditor/icons/preview/wordsHovered.svg new file mode 100644 index 00000000..d99d09d6 --- /dev/null +++ b/flatlaf-theme-editor/src/main/resources/com/formdev/flatlaf/themeeditor/icons/preview/wordsHovered.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/flatlaf-theme-editor/src/main/resources/com/formdev/flatlaf/themeeditor/icons/preview/wordsSelected.svg b/flatlaf-theme-editor/src/main/resources/com/formdev/flatlaf/themeeditor/icons/preview/wordsSelected.svg new file mode 100644 index 00000000..21533311 --- /dev/null +++ b/flatlaf-theme-editor/src/main/resources/com/formdev/flatlaf/themeeditor/icons/preview/wordsSelected.svg @@ -0,0 +1,6 @@ + + + + + +