SwingX: added search and clear icons to JXSearchField (issue #359)

This commit is contained in:
Karl Tauber
2021-08-03 17:52:49 +02:00
parent d373687bc4
commit bce58bc97b
18 changed files with 399 additions and 3 deletions

View File

@@ -124,6 +124,11 @@ public class FlatSwingXTest
JTextField textField3 = new JTextField();
JLabel label10 = new JLabel();
JTextField textField4 = new JTextField();
JLabel label11 = new JLabel();
JXSearchField xSearchField1 = new JXSearchField();
JXSearchField xSearchField2 = new JXSearchField();
JXSearchField xSearchField3 = new JXSearchField();
JXSearchField xSearchField4 = new JXSearchField();
JButton button1 = new JButton();
JButton button2 = new JButton();
@@ -146,6 +151,8 @@ public class FlatSwingXTest
"[]" +
"[]" +
"[]" +
"[]" +
"[]" +
"[37]"));
//---- label1 ----
@@ -425,6 +432,30 @@ public class FlatSwingXTest
}
add(xTitledPanel2, "cell 3 8,grow");
//---- label11 ----
label11.setText("JXSearchField:");
add(label11, "cell 0 9");
//---- xSearchField1 ----
xSearchField1.setText("abc");
add(xSearchField1, "cell 1 9,growx");
//---- xSearchField2 ----
xSearchField2.setEnabled(false);
xSearchField2.setText("abc");
add(xSearchField2, "cell 2 9,growx");
//---- xSearchField3 ----
xSearchField3.setRecentSearchesSaveKey("flatlaf.swingx.search.recent");
xSearchField3.setText("abc");
add(xSearchField3, "cell 1 10,growx");
//---- xSearchField4 ----
xSearchField4.setRecentSearchesSaveKey("flatlaf.swingx.search.recent");
xSearchField4.setEnabled(false);
xSearchField4.setText("abc");
add(xSearchField4, "cell 2 10,growx");
//---- button1 ----
button1.setText("<");

View File

@@ -1,4 +1,4 @@
JFDML JFormDesigner: "7.0.0.0.194" Java: "11.0.2" encoding: "UTF-8"
JFDML JFormDesigner: "7.0.4.0.360" Java: "16" encoding: "UTF-8"
new FormModel {
contentType: "form/swing"
@@ -9,7 +9,7 @@ new FormModel {
add( new FormContainer( "com.formdev.flatlaf.testing.FlatTestPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) {
"$layoutConstraints": "ltr,insets dialog,hidemode 3"
"$columnConstraints": "[left][][][][fill]"
"$rowConstraints": "[]0[][]0[top][][][][][][37]"
"$rowConstraints": "[]0[][]0[top][][][][][][][][37]"
} ) {
name: "this"
add( new FormComponent( "javax.swing.JLabel" ) {
@@ -354,6 +354,40 @@ new FormModel {
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 3 8,grow"
} )
add( new FormComponent( "javax.swing.JLabel" ) {
name: "label11"
"text": "JXSearchField:"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 0 9"
} )
add( new FormComponent( "org.jdesktop.swingx.JXSearchField" ) {
name: "xSearchField1"
"text": "abc"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 9,growx"
} )
add( new FormComponent( "org.jdesktop.swingx.JXSearchField" ) {
name: "xSearchField2"
"enabled": false
"text": "abc"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 2 9,growx"
} )
add( new FormComponent( "org.jdesktop.swingx.JXSearchField" ) {
name: "xSearchField3"
"recentSearchesSaveKey": "flatlaf.swingx.search.recent"
"text": "abc"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 10,growx"
} )
add( new FormComponent( "org.jdesktop.swingx.JXSearchField" ) {
name: "xSearchField4"
"recentSearchesSaveKey": "flatlaf.swingx.search.recent"
"enabled": false
"text": "abc"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 2 10,growx"
} )
}, new FormLayoutConstraints( null ) {
"location": new java.awt.Point( 0, 0 )
"size": new java.awt.Dimension( 700, 600 )