diff --git a/flatlaf-core/src/main/java/com/formdev/flatlaf/FlatClientProperties.java b/flatlaf-core/src/main/java/com/formdev/flatlaf/FlatClientProperties.java
index d03e5ae2..ed1a1b2d 100644
--- a/flatlaf-core/src/main/java/com/formdev/flatlaf/FlatClientProperties.java
+++ b/flatlaf-core/src/main/java/com/formdev/flatlaf/FlatClientProperties.java
@@ -181,7 +181,7 @@ public interface FlatClientProperties
* Use a {@link java.util.function.Predicate} that receives the component as parameter:
*
{@code
* myComponent.putClientProperty( "JComponent.focusOwner",
- * (Predicate) c -> {
+ * (Predicate) c -> {
* return ...; // check here
* } );
* }
diff --git a/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatComponentStateTest.java b/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatComponentStateTest.java
index dc6ebc07..5a0468be 100644
--- a/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatComponentStateTest.java
+++ b/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatComponentStateTest.java
@@ -16,7 +16,6 @@
package com.formdev.flatlaf.testing;
-import java.awt.Component;
import java.util.function.Predicate;
import javax.swing.*;
import com.formdev.flatlaf.FlatClientProperties;
@@ -37,6 +36,13 @@ public class FlatComponentStateTest
FlatComponentStateTest() {
initComponents();
+
+ Predicate unfocused = c -> false;
+ Predicate focused = c -> true;
+ textField1.putClientProperty( FlatClientProperties.COMPONENT_FOCUS_OWNER, unfocused );
+ textField2.putClientProperty( FlatClientProperties.COMPONENT_FOCUS_OWNER, focused );
+ comboBox1.putClientProperty( FlatClientProperties.COMPONENT_FOCUS_OWNER, unfocused );
+ comboBox2.putClientProperty( FlatClientProperties.COMPONENT_FOCUS_OWNER, focused );
}
private void initComponents() {
@@ -147,6 +153,13 @@ public class FlatComponentStateTest
checkBox2 = new JCheckBox();
radioButton1 = new JRadioButton();
radioButton2 = new JRadioButton();
+ separator2 = new JSeparator();
+ label35 = new JLabel();
+ textField1 = new JTextField();
+ textField2 = new JTextField();
+ label38 = new JLabel();
+ comboBox1 = new JComboBox<>();
+ comboBox2 = new JComboBox<>();
//======== this ========
setLayout(new MigLayout(
@@ -178,6 +191,9 @@ public class FlatComponentStateTest
"[]" +
"[]" +
"[]para" +
+ "[]" +
+ "[]" +
+ "[]" +
"[]"));
//---- label11 ----
@@ -732,6 +748,19 @@ public class FlatComponentStateTest
radioButton2.setText("text");
radioButton2.setSelected(true);
add(radioButton2, "cell 6 14");
+ add(separator2, "cell 0 15 11 1");
+
+ //---- label35 ----
+ label35.setText("JTextField");
+ add(label35, "cell 0 16");
+ add(textField1, "cell 1 16 2 1");
+ add(textField2, "cell 3 16 2 1");
+
+ //---- label38 ----
+ label38.setText("JComboBox");
+ add(label38, "cell 0 17");
+ add(comboBox1, "cell 1 17 2 1");
+ add(comboBox2, "cell 3 17 2 1");
// JFormDesigner - End of component initialization //GEN-END:initComponents
}
@@ -842,6 +871,13 @@ public class FlatComponentStateTest
private JCheckBox checkBox2;
private JRadioButton radioButton1;
private JRadioButton radioButton2;
+ private JSeparator separator2;
+ private JLabel label35;
+ private JTextField textField1;
+ private JTextField textField2;
+ private JLabel label38;
+ private JComboBox comboBox1;
+ private JComboBox comboBox2;
// JFormDesigner - End of variables declaration //GEN-END:variables
//---- class TestStateButton ----------------------------------------------
@@ -867,7 +903,7 @@ public class FlatComponentStateTest
} );
putClientProperty( FlatClientProperties.COMPONENT_FOCUS_OWNER,
- (Predicate) c -> {
+ (Predicate) c -> {
return ((TestStateButton)c).isStateFocused();
} );
}
@@ -937,7 +973,7 @@ public class FlatComponentStateTest
} );
putClientProperty( FlatClientProperties.COMPONENT_FOCUS_OWNER,
- (Predicate) c -> {
+ (Predicate) c -> {
return ((TestStateToggleButton)c).isStateFocused();
} );
}
@@ -1002,7 +1038,7 @@ public class FlatComponentStateTest
} );
putClientProperty( FlatClientProperties.COMPONENT_FOCUS_OWNER,
- (Predicate) c -> {
+ (Predicate) c -> {
return ((TestStateCheckBox)c).isStateFocused();
} );
}
@@ -1067,7 +1103,7 @@ public class FlatComponentStateTest
} );
putClientProperty( FlatClientProperties.COMPONENT_FOCUS_OWNER,
- (Predicate) c -> {
+ (Predicate) c -> {
return ((TestStateRadioButton)c).isStateFocused();
} );
}
diff --git a/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatComponentStateTest.jfd b/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatComponentStateTest.jfd
index ba475565..535ce9a0 100644
--- a/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatComponentStateTest.jfd
+++ b/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatComponentStateTest.jfd
@@ -6,7 +6,7 @@ new FormModel {
add( new FormContainer( "com.formdev.flatlaf.testing.FlatTestPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) {
"$layoutConstraints": "hidemode 3"
"$columnConstraints": "[fill][fill][fill]para[fill][fill]para[fill][fill]para[fill][fill]para[fill][fill]"
- "$rowConstraints": "[][][][][][]para[][][][][][][][]para[]"
+ "$rowConstraints": "[][][][][][]para[][][][][][][][]para[][][][]"
} ) {
name: "this"
add( new FormComponent( "javax.swing.JLabel" ) {
@@ -776,6 +776,49 @@ new FormModel {
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 6 14"
} )
+ add( new FormComponent( "javax.swing.JSeparator" ) {
+ name: "separator2"
+ }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
+ "value": "cell 0 15 11 1"
+ } )
+ add( new FormComponent( "javax.swing.JLabel" ) {
+ name: "label35"
+ "text": "JTextField"
+ }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
+ "value": "cell 0 16"
+ } )
+ add( new FormComponent( "javax.swing.JTextField" ) {
+ name: "textField1"
+ }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
+ "value": "cell 1 16 2 1"
+ } )
+ add( new FormComponent( "javax.swing.JTextField" ) {
+ name: "textField2"
+ }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
+ "value": "cell 3 16 2 1"
+ } )
+ add( new FormComponent( "javax.swing.JLabel" ) {
+ name: "label38"
+ "text": "JComboBox"
+ }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
+ "value": "cell 0 17"
+ } )
+ add( new FormComponent( "javax.swing.JComboBox" ) {
+ name: "comboBox1"
+ auxiliary() {
+ "JavaCodeGenerator.typeParameters": "String"
+ }
+ }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
+ "value": "cell 1 17 2 1"
+ } )
+ add( new FormComponent( "javax.swing.JComboBox" ) {
+ name: "comboBox2"
+ auxiliary() {
+ "JavaCodeGenerator.typeParameters": "String"
+ }
+ }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
+ "value": "cell 3 17 2 1"
+ } )
}, new FormLayoutConstraints( null ) {
"location": new java.awt.Point( 0, 0 )
"size": new java.awt.Dimension( 785, 685 )