Theme Editor: always select all text in find/replace text fields

This commit is contained in:
Karl Tauber
2021-08-07 12:55:25 +02:00
parent 49913b7dad
commit ed62266a43
2 changed files with 12 additions and 7 deletions

View File

@@ -23,6 +23,7 @@ import java.util.function.Consumer;
import javax.swing.*;
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
import com.formdev.flatlaf.extras.components.*;
import org.fife.rsta.ui.CollapsibleSectionPanel;
import org.fife.ui.rsyntaxtextarea.RSyntaxTextArea;
import org.fife.ui.rtextarea.SearchContext;
@@ -204,7 +205,7 @@ class FlatFindReplaceBar
private void initComponents() {
// JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents
findLabel = new JLabel();
findField = new JTextField();
findField = new FlatTextField();
findToolBar = new JToolBar();
findPreviousButton = new JButton();
findNextButton = new JButton();
@@ -215,7 +216,7 @@ class FlatFindReplaceBar
closeToolBar = new JToolBar();
closeButton = new JButton();
replaceLabel = new JLabel();
replaceField = new JTextField();
replaceField = new FlatTextField();
toolBar1 = new JToolBar();
replaceButton = new JButton();
replaceAllButton = new JButton();
@@ -243,6 +244,7 @@ class FlatFindReplaceBar
//---- findField ----
findField.setColumns(16);
findField.setSelectAllOnFocusPolicy(FlatTextField.SelectAllOnFocusPolicy.always);
findField.addActionListener(e -> find());
add(findField, "cell 1 0");
@@ -303,6 +305,7 @@ class FlatFindReplaceBar
//---- replaceField ----
replaceField.setColumns(16);
replaceField.setSelectAllOnFocusPolicy(FlatTextField.SelectAllOnFocusPolicy.always);
add(replaceField, "cell 1 1");
//======== toolBar1 ========
@@ -332,7 +335,7 @@ class FlatFindReplaceBar
// JFormDesigner - Variables declaration - DO NOT MODIFY //GEN-BEGIN:variables
private JLabel findLabel;
private JTextField findField;
private FlatTextField findField;
private JToolBar findToolBar;
private JButton findPreviousButton;
private JButton findNextButton;
@@ -343,7 +346,7 @@ class FlatFindReplaceBar
private JToolBar closeToolBar;
private JButton closeButton;
private JLabel replaceLabel;
private JTextField replaceField;
private FlatTextField replaceField;
private JToolBar toolBar1;
private JButton replaceButton;
private JButton replaceAllButton;

View File

@@ -1,4 +1,4 @@
JFDML JFormDesigner: "7.0.3.1.342" Java: "15" encoding: "UTF-8"
JFDML JFormDesigner: "7.0.4.0.360" Java: "16" encoding: "UTF-8"
new FormModel {
contentType: "form/swing"
@@ -18,9 +18,10 @@ new FormModel {
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 0 0"
} )
add( new FormComponent( "javax.swing.JTextField" ) {
add( new FormComponent( "com.formdev.flatlaf.extras.components.FlatTextField" ) {
name: "findField"
"columns": 16
"selectAllOnFocusPolicy": enum com.formdev.flatlaf.extras.components.FlatTextField$SelectAllOnFocusPolicy always
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "find", false ) )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 0"
@@ -86,9 +87,10 @@ new FormModel {
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 0 1"
} )
add( new FormComponent( "javax.swing.JTextField" ) {
add( new FormComponent( "com.formdev.flatlaf.extras.components.FlatTextField" ) {
name: "replaceField"
"columns": 16
"selectAllOnFocusPolicy": enum com.formdev.flatlaf.extras.components.FlatTextField$SelectAllOnFocusPolicy always
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 1"
} )