mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2026-02-11 06:27:13 -06:00
Theme Editor: added text field leading/trailing buttons/toolbar to preview
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
<!-- Copyright 2000-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. -->
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16">
|
||||
<g fill="none" fill-opacity=".5" fill-rule="evenodd">
|
||||
<rect width="2" height="2" x="3" y="11" fill="#7F8B91"/>
|
||||
<path fill="#7F8B91" d="M9.8339746,5.61435935 L12.0980762,4.30717968 L12.8980762,5.69282032 L10.6339746,7 L12.8980762,8.30717968 L12.0980762,9.69282032 L9.8339746,8.38564065 L9.8339746,11 L8.2339746,11 L8.2339746,8.38564065 L5.96987298,9.69282032 L5.16987298,8.30717968 L7.4339746,7 L5.16987298,5.69282032 L5.96987298,4.30717968 L8.2339746,5.61435935 L8.2339746,3 L9.8339746,3 L9.8339746,5.61435935 Z"/>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 770 B |
@@ -0,0 +1,7 @@
|
||||
<!-- Copyright 2000-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. -->
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16">
|
||||
<g fill="none" fill-opacity=".9" fill-rule="evenodd">
|
||||
<rect width="2" height="2" x="3" y="11" fill="#7F8B91"/>
|
||||
<path fill="#7F8B91" d="M9.8339746,5.61435935 L12.0980762,4.30717968 L12.8980762,5.69282032 L10.6339746,7 L12.8980762,8.30717968 L12.0980762,9.69282032 L9.8339746,8.38564065 L9.8339746,11 L8.2339746,11 L8.2339746,8.38564065 L5.96987298,9.69282032 L5.16987298,8.30717968 L7.4339746,7 L5.16987298,5.69282032 L5.96987298,4.30717968 L8.2339746,5.61435935 L8.2339746,3 L9.8339746,3 L9.8339746,5.61435935 Z"/>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 770 B |
@@ -0,0 +1,7 @@
|
||||
<!-- Copyright 2000-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. -->
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16">
|
||||
<g fill="none" fill-rule="evenodd">
|
||||
<rect width="2" height="2" x="3" y="11" fill="#40B6E0"/>
|
||||
<path fill="#40B6E0" d="M9.8339746,5.61435935 L12.0980762,4.30717968 L12.8980762,5.69282032 L10.6339746,7 L12.8980762,8.30717968 L12.0980762,9.69282032 L9.8339746,8.38564065 L9.8339746,11 L8.2339746,11 L8.2339746,8.38564065 L5.96987298,9.69282032 L5.16987298,8.30717968 L7.4339746,7 L5.16987298,5.69282032 L5.96987298,4.30717968 L8.2339746,5.61435935 L8.2339746,3 L9.8339746,3 L9.8339746,5.61435935 Z"/>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 752 B |
@@ -0,0 +1,6 @@
|
||||
<!-- Copyright 2000-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. -->
|
||||
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<g id="words">
|
||||
<path id="W" d="M14.5213 3.01418L11.6986 13H9.82624L8.01064 6.68794L6.19504 13H4.3227L1.5 3.01418H3.67021L5.3156 9.53901L7.14539 3H8.93262L10.7482 9.53901L12.4078 3.01418H14.5213Z" fill="#7F8B91" fill-opacity="0.5"/>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 487 B |
@@ -0,0 +1,6 @@
|
||||
<!-- Copyright 2000-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. -->
|
||||
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<g id="wordsHovered">
|
||||
<path id="W" d="M14.5213 3.01418L11.6986 13H9.82624L8.01064 6.68794L6.19504 13H4.3227L1.5 3.01418H3.67021L5.3156 9.53901L7.14539 3H8.93262L10.7482 9.53901L12.4078 3.01418H14.5213Z" fill="#7F8B91" fill-opacity="0.9"/>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 494 B |
@@ -0,0 +1,6 @@
|
||||
<!-- Copyright 2000-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. -->
|
||||
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<g id="wordsSelected">
|
||||
<path id="W" d="M14.5213 3.01418L11.6986 13H9.82624L8.01064 6.68794L6.19504 13H4.3227L1.5 3.01418H3.67021L5.3156 9.53901L7.14539 3H8.93262L10.7482 9.53901L12.4078 3.01418H14.5213Z" fill="#40B6E0"/>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 476 B |
Reference in New Issue
Block a user