mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2025-12-06 22:10:54 +03:00
TextField: added "clear" button to theme editor find/replace and to UI defaults inspector
This commit is contained in:
@@ -43,6 +43,7 @@ import javax.swing.table.AbstractTableModel;
|
|||||||
import javax.swing.table.DefaultTableCellRenderer;
|
import javax.swing.table.DefaultTableCellRenderer;
|
||||||
import javax.swing.table.TableColumnModel;
|
import javax.swing.table.TableColumnModel;
|
||||||
import com.formdev.flatlaf.FlatLaf;
|
import com.formdev.flatlaf.FlatLaf;
|
||||||
|
import com.formdev.flatlaf.extras.components.FlatTextField;
|
||||||
import com.formdev.flatlaf.icons.FlatAbstractIcon;
|
import com.formdev.flatlaf.icons.FlatAbstractIcon;
|
||||||
import com.formdev.flatlaf.ui.FlatBorder;
|
import com.formdev.flatlaf.ui.FlatBorder;
|
||||||
import com.formdev.flatlaf.ui.FlatEmptyBorder;
|
import com.formdev.flatlaf.ui.FlatEmptyBorder;
|
||||||
@@ -557,7 +558,7 @@ public class FlatUIDefaultsInspector
|
|||||||
panel = new JPanel();
|
panel = new JPanel();
|
||||||
filterPanel = new JPanel();
|
filterPanel = new JPanel();
|
||||||
flterLabel = new JLabel();
|
flterLabel = new JLabel();
|
||||||
filterField = new JTextField();
|
filterField = new FlatTextField();
|
||||||
valueTypeLabel = new JLabel();
|
valueTypeLabel = new JLabel();
|
||||||
valueTypeField = new JComboBox<>();
|
valueTypeField = new JComboBox<>();
|
||||||
scrollPane = new JScrollPane();
|
scrollPane = new JScrollPane();
|
||||||
@@ -588,7 +589,8 @@ public class FlatUIDefaultsInspector
|
|||||||
new Insets(0, 0, 0, 10), 0, 0));
|
new Insets(0, 0, 0, 10), 0, 0));
|
||||||
|
|
||||||
//---- filterField ----
|
//---- filterField ----
|
||||||
filterField.putClientProperty("JTextField.placeholderText", "enter one or more filter strings, separated by space characters");
|
filterField.setPlaceholderText("enter one or more filter strings, separated by space characters");
|
||||||
|
filterField.setShowClearButton(true);
|
||||||
filterPanel.add(filterField, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0,
|
filterPanel.add(filterField, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0,
|
||||||
GridBagConstraints.CENTER, GridBagConstraints.BOTH,
|
GridBagConstraints.CENTER, GridBagConstraints.BOTH,
|
||||||
new Insets(0, 0, 0, 10), 0, 0));
|
new Insets(0, 0, 0, 10), 0, 0));
|
||||||
@@ -667,7 +669,7 @@ public class FlatUIDefaultsInspector
|
|||||||
private JPanel panel;
|
private JPanel panel;
|
||||||
private JPanel filterPanel;
|
private JPanel filterPanel;
|
||||||
private JLabel flterLabel;
|
private JLabel flterLabel;
|
||||||
private JTextField filterField;
|
private FlatTextField filterField;
|
||||||
private JLabel valueTypeLabel;
|
private JLabel valueTypeLabel;
|
||||||
private JComboBox<String> valueTypeField;
|
private JComboBox<String> valueTypeField;
|
||||||
private JScrollPane scrollPane;
|
private JScrollPane scrollPane;
|
||||||
|
|||||||
@@ -20,9 +20,10 @@ new FormModel {
|
|||||||
"labelFor": new FormReference( "filterField" )
|
"labelFor": new FormReference( "filterField" )
|
||||||
"displayedMnemonic": 70
|
"displayedMnemonic": 70
|
||||||
}, new FormLayoutConstraints( class com.jformdesigner.runtime.GridBagConstraintsEx ) )
|
}, new FormLayoutConstraints( class com.jformdesigner.runtime.GridBagConstraintsEx ) )
|
||||||
add( new FormComponent( "javax.swing.JTextField" ) {
|
add( new FormComponent( "com.formdev.flatlaf.extras.components.FlatTextField" ) {
|
||||||
name: "filterField"
|
name: "filterField"
|
||||||
"$client.JTextField.placeholderText": "enter one or more filter strings, separated by space characters"
|
"placeholderText": "enter one or more filter strings, separated by space characters"
|
||||||
|
"showClearButton": true
|
||||||
}, new FormLayoutConstraints( class com.jformdesigner.runtime.GridBagConstraintsEx ) {
|
}, new FormLayoutConstraints( class com.jformdesigner.runtime.GridBagConstraintsEx ) {
|
||||||
"gridx": 1
|
"gridx": 1
|
||||||
} )
|
} )
|
||||||
|
|||||||
@@ -304,6 +304,7 @@ class FlatFindReplaceBar
|
|||||||
//---- findField ----
|
//---- findField ----
|
||||||
findField.setColumns(16);
|
findField.setColumns(16);
|
||||||
findField.setSelectAllOnFocusPolicy(FlatTextField.SelectAllOnFocusPolicy.always);
|
findField.setSelectAllOnFocusPolicy(FlatTextField.SelectAllOnFocusPolicy.always);
|
||||||
|
findField.setShowClearButton(true);
|
||||||
findField.addActionListener(e -> find());
|
findField.addActionListener(e -> find());
|
||||||
add(findField, "cell 1 0");
|
add(findField, "cell 1 0");
|
||||||
|
|
||||||
@@ -365,6 +366,7 @@ class FlatFindReplaceBar
|
|||||||
//---- replaceField ----
|
//---- replaceField ----
|
||||||
replaceField.setColumns(16);
|
replaceField.setColumns(16);
|
||||||
replaceField.setSelectAllOnFocusPolicy(FlatTextField.SelectAllOnFocusPolicy.always);
|
replaceField.setSelectAllOnFocusPolicy(FlatTextField.SelectAllOnFocusPolicy.always);
|
||||||
|
replaceField.setShowClearButton(true);
|
||||||
add(replaceField, "cell 1 1");
|
add(replaceField, "cell 1 1");
|
||||||
|
|
||||||
//======== toolBar1 ========
|
//======== toolBar1 ========
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ new FormModel {
|
|||||||
name: "findField"
|
name: "findField"
|
||||||
"columns": 16
|
"columns": 16
|
||||||
"selectAllOnFocusPolicy": enum com.formdev.flatlaf.extras.components.FlatTextField$SelectAllOnFocusPolicy always
|
"selectAllOnFocusPolicy": enum com.formdev.flatlaf.extras.components.FlatTextField$SelectAllOnFocusPolicy always
|
||||||
|
"showClearButton": true
|
||||||
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "find", false ) )
|
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "find", false ) )
|
||||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||||
"value": "cell 1 0"
|
"value": "cell 1 0"
|
||||||
@@ -91,6 +92,7 @@ new FormModel {
|
|||||||
name: "replaceField"
|
name: "replaceField"
|
||||||
"columns": 16
|
"columns": 16
|
||||||
"selectAllOnFocusPolicy": enum com.formdev.flatlaf.extras.components.FlatTextField$SelectAllOnFocusPolicy always
|
"selectAllOnFocusPolicy": enum com.formdev.flatlaf.extras.components.FlatTextField$SelectAllOnFocusPolicy always
|
||||||
|
"showClearButton": true
|
||||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||||
"value": "cell 1 1"
|
"value": "cell 1 1"
|
||||||
} )
|
} )
|
||||||
|
|||||||
Reference in New Issue
Block a user