mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2026-02-11 06:27:13 -06:00
ComboBox: if using own JTextField as editor, default text field border is now removed to avoid duplicate border
This commit is contained in:
@@ -12,6 +12,11 @@ FlatLaf Change Log
|
|||||||
- TabbedPane: Support hiding separator between tabs and content area (set client
|
- TabbedPane: Support hiding separator between tabs and content area (set client
|
||||||
property `JTabbedPane.showContentSeparator` to `false`).
|
property `JTabbedPane.showContentSeparator` to `false`).
|
||||||
|
|
||||||
|
#### Fixed bugs
|
||||||
|
|
||||||
|
- ComboBox: If using own `JTextField` as editor, default text field border is
|
||||||
|
now removed to avoid duplicate border.
|
||||||
|
|
||||||
|
|
||||||
## 0.42
|
## 0.42
|
||||||
|
|
||||||
|
|||||||
@@ -298,6 +298,10 @@ public class FlatComboBoxUI
|
|||||||
protected void configureEditor() {
|
protected void configureEditor() {
|
||||||
super.configureEditor();
|
super.configureEditor();
|
||||||
|
|
||||||
|
// remove default text field border from editor
|
||||||
|
if( editor instanceof JTextField && ((JTextField)editor).getBorder() instanceof FlatTextBorder )
|
||||||
|
((JTextField)editor).setBorder( BorderFactory.createEmptyBorder() );
|
||||||
|
|
||||||
// explicitly make non-opaque
|
// explicitly make non-opaque
|
||||||
if( editor instanceof JComponent )
|
if( editor instanceof JComponent )
|
||||||
((JComponent)editor).setOpaque( false );
|
((JComponent)editor).setOpaque( false );
|
||||||
|
|||||||
@@ -97,6 +97,8 @@ public class FlatCustomBordersTest
|
|||||||
applyCustomComboBoxEditorBorder( comboBox18 );
|
applyCustomComboBoxEditorBorder( comboBox18 );
|
||||||
applyCustomComboBoxEditorBorderWithIcon( comboBox19 );
|
applyCustomComboBoxEditorBorderWithIcon( comboBox19 );
|
||||||
applyCustomComboBoxEditorBorderWithIcon( comboBox20 );
|
applyCustomComboBoxEditorBorderWithIcon( comboBox20 );
|
||||||
|
applyCustomComboBoxEditorBorder( comboBox21, null );
|
||||||
|
applyCustomComboBoxEditorBorder( comboBox22, null );
|
||||||
}
|
}
|
||||||
|
|
||||||
private void applyCustomInsideBorder( JComponent c, String uiKey ) {
|
private void applyCustomInsideBorder( JComponent c, String uiKey ) {
|
||||||
@@ -117,7 +119,8 @@ public class FlatCustomBordersTest
|
|||||||
|
|
||||||
private void applyCustomComboBoxEditorBorder( JComboBox<String> comboBox, Border border ) {
|
private void applyCustomComboBoxEditorBorder( JComboBox<String> comboBox, Border border ) {
|
||||||
JTextField customTextField = new JTextField();
|
JTextField customTextField = new JTextField();
|
||||||
customTextField.setBorder( border );
|
if( border != null )
|
||||||
|
customTextField.setBorder( border );
|
||||||
comboBox.setEditor( new BasicComboBoxEditor() {
|
comboBox.setEditor( new BasicComboBoxEditor() {
|
||||||
@Override
|
@Override
|
||||||
protected JTextField createEditorComponent() {
|
protected JTextField createEditorComponent() {
|
||||||
@@ -134,6 +137,7 @@ public class FlatCustomBordersTest
|
|||||||
label2 = new JLabel();
|
label2 = new JLabel();
|
||||||
label8 = new JLabel();
|
label8 = new JLabel();
|
||||||
label9 = new JLabel();
|
label9 = new JLabel();
|
||||||
|
label10 = new JLabel();
|
||||||
label7 = new JLabel();
|
label7 = new JLabel();
|
||||||
button1 = new JButton();
|
button1 = new JButton();
|
||||||
button2 = new JButton();
|
button2 = new JButton();
|
||||||
@@ -158,12 +162,14 @@ public class FlatCustomBordersTest
|
|||||||
comboBox12 = new JComboBox<>();
|
comboBox12 = new JComboBox<>();
|
||||||
comboBox17 = new JComboBox<>();
|
comboBox17 = new JComboBox<>();
|
||||||
comboBox19 = new JComboBox<>();
|
comboBox19 = new JComboBox<>();
|
||||||
|
comboBox21 = new JComboBox<>();
|
||||||
comboBox13 = new JComboBox<>();
|
comboBox13 = new JComboBox<>();
|
||||||
comboBox14 = new JComboBox<>();
|
comboBox14 = new JComboBox<>();
|
||||||
comboBox15 = new JComboBox<>();
|
comboBox15 = new JComboBox<>();
|
||||||
comboBox16 = new JComboBox<>();
|
comboBox16 = new JComboBox<>();
|
||||||
comboBox18 = new JComboBox<>();
|
comboBox18 = new JComboBox<>();
|
||||||
comboBox20 = new JComboBox<>();
|
comboBox20 = new JComboBox<>();
|
||||||
|
comboBox22 = new JComboBox<>();
|
||||||
label6 = new JLabel();
|
label6 = new JLabel();
|
||||||
spinner1 = new JSpinner();
|
spinner1 = new JSpinner();
|
||||||
spinner2 = new JSpinner();
|
spinner2 = new JSpinner();
|
||||||
@@ -193,6 +199,7 @@ public class FlatCustomBordersTest
|
|||||||
"[fill]" +
|
"[fill]" +
|
||||||
"[fill]" +
|
"[fill]" +
|
||||||
"[fill]" +
|
"[fill]" +
|
||||||
|
"[fill]" +
|
||||||
"[fill]",
|
"[fill]",
|
||||||
// rows
|
// rows
|
||||||
"[]" +
|
"[]" +
|
||||||
@@ -231,6 +238,10 @@ public class FlatCustomBordersTest
|
|||||||
label9.setText("with icon");
|
label9.setText("with icon");
|
||||||
add(label9, "cell 6 0");
|
add(label9, "cell 6 0");
|
||||||
|
|
||||||
|
//---- label10 ----
|
||||||
|
label10.setText("with default border");
|
||||||
|
add(label10, "cell 7 0");
|
||||||
|
|
||||||
//---- label7 ----
|
//---- label7 ----
|
||||||
label7.setText("JButton:");
|
label7.setText("JButton:");
|
||||||
add(label7, "cell 0 1");
|
add(label7, "cell 0 1");
|
||||||
@@ -319,6 +330,10 @@ public class FlatCustomBordersTest
|
|||||||
comboBox19.setEditable(true);
|
comboBox19.setEditable(true);
|
||||||
add(comboBox19, "cell 6 5");
|
add(comboBox19, "cell 6 5");
|
||||||
|
|
||||||
|
//---- comboBox21 ----
|
||||||
|
comboBox21.setEditable(true);
|
||||||
|
add(comboBox21, "cell 7 5");
|
||||||
|
|
||||||
//---- comboBox13 ----
|
//---- comboBox13 ----
|
||||||
comboBox13.putClientProperty("JComponent.roundRect", true);
|
comboBox13.putClientProperty("JComponent.roundRect", true);
|
||||||
comboBox13.setEditable(true);
|
comboBox13.setEditable(true);
|
||||||
@@ -349,6 +364,11 @@ public class FlatCustomBordersTest
|
|||||||
comboBox20.setEditable(true);
|
comboBox20.setEditable(true);
|
||||||
add(comboBox20, "cell 6 6");
|
add(comboBox20, "cell 6 6");
|
||||||
|
|
||||||
|
//---- comboBox22 ----
|
||||||
|
comboBox22.putClientProperty("JComponent.roundRect", true);
|
||||||
|
comboBox22.setEditable(true);
|
||||||
|
add(comboBox22, "cell 7 6");
|
||||||
|
|
||||||
//---- label6 ----
|
//---- label6 ----
|
||||||
label6.setText("JSpinner:");
|
label6.setText("JSpinner:");
|
||||||
add(label6, "cell 0 7");
|
add(label6, "cell 0 7");
|
||||||
@@ -425,6 +445,7 @@ public class FlatCustomBordersTest
|
|||||||
private JLabel label2;
|
private JLabel label2;
|
||||||
private JLabel label8;
|
private JLabel label8;
|
||||||
private JLabel label9;
|
private JLabel label9;
|
||||||
|
private JLabel label10;
|
||||||
private JLabel label7;
|
private JLabel label7;
|
||||||
private JButton button1;
|
private JButton button1;
|
||||||
private JButton button2;
|
private JButton button2;
|
||||||
@@ -449,12 +470,14 @@ public class FlatCustomBordersTest
|
|||||||
private JComboBox<String> comboBox12;
|
private JComboBox<String> comboBox12;
|
||||||
private JComboBox<String> comboBox17;
|
private JComboBox<String> comboBox17;
|
||||||
private JComboBox<String> comboBox19;
|
private JComboBox<String> comboBox19;
|
||||||
|
private JComboBox<String> comboBox21;
|
||||||
private JComboBox<String> comboBox13;
|
private JComboBox<String> comboBox13;
|
||||||
private JComboBox<String> comboBox14;
|
private JComboBox<String> comboBox14;
|
||||||
private JComboBox<String> comboBox15;
|
private JComboBox<String> comboBox15;
|
||||||
private JComboBox<String> comboBox16;
|
private JComboBox<String> comboBox16;
|
||||||
private JComboBox<String> comboBox18;
|
private JComboBox<String> comboBox18;
|
||||||
private JComboBox<String> comboBox20;
|
private JComboBox<String> comboBox20;
|
||||||
|
private JComboBox<String> comboBox22;
|
||||||
private JLabel label6;
|
private JLabel label6;
|
||||||
private JSpinner spinner1;
|
private JSpinner spinner1;
|
||||||
private JSpinner spinner2;
|
private JSpinner spinner2;
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
JFDML JFormDesigner: "7.0.1.0.272" Java: "13.0.2" encoding: "UTF-8"
|
JFDML JFormDesigner: "7.0.2.0.298" Java: "15" encoding: "UTF-8"
|
||||||
|
|
||||||
new FormModel {
|
new FormModel {
|
||||||
contentType: "form/swing"
|
contentType: "form/swing"
|
||||||
root: new FormRoot {
|
root: new FormRoot {
|
||||||
add( new FormContainer( "com.formdev.flatlaf.testing.FlatTestPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) {
|
add( new FormContainer( "com.formdev.flatlaf.testing.FlatTestPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) {
|
||||||
"$layoutConstraints": "ltr,insets dialog,hidemode 3"
|
"$layoutConstraints": "ltr,insets dialog,hidemode 3"
|
||||||
"$columnConstraints": "[][fill][fill][fill][fill][fill][fill]"
|
"$columnConstraints": "[][fill][fill][fill][fill][fill][fill][fill]"
|
||||||
"$rowConstraints": "[][][][][][][][][][][]"
|
"$rowConstraints": "[][][][][][][][][][][]"
|
||||||
} ) {
|
} ) {
|
||||||
name: "this"
|
name: "this"
|
||||||
@@ -45,6 +45,12 @@ new FormModel {
|
|||||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||||
"value": "cell 6 0"
|
"value": "cell 6 0"
|
||||||
} )
|
} )
|
||||||
|
add( new FormComponent( "javax.swing.JLabel" ) {
|
||||||
|
name: "label10"
|
||||||
|
"text": "with default border"
|
||||||
|
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||||
|
"value": "cell 7 0"
|
||||||
|
} )
|
||||||
add( new FormComponent( "javax.swing.JLabel" ) {
|
add( new FormComponent( "javax.swing.JLabel" ) {
|
||||||
name: "label7"
|
name: "label7"
|
||||||
"text": "JButton:"
|
"text": "JButton:"
|
||||||
@@ -231,6 +237,15 @@ new FormModel {
|
|||||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||||
"value": "cell 6 5"
|
"value": "cell 6 5"
|
||||||
} )
|
} )
|
||||||
|
add( new FormComponent( "javax.swing.JComboBox" ) {
|
||||||
|
name: "comboBox21"
|
||||||
|
"editable": true
|
||||||
|
auxiliary() {
|
||||||
|
"JavaCodeGenerator.typeParameters": "String"
|
||||||
|
}
|
||||||
|
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||||
|
"value": "cell 7 5"
|
||||||
|
} )
|
||||||
add( new FormComponent( "javax.swing.JComboBox" ) {
|
add( new FormComponent( "javax.swing.JComboBox" ) {
|
||||||
name: "comboBox13"
|
name: "comboBox13"
|
||||||
"$client.JComponent.roundRect": true
|
"$client.JComponent.roundRect": true
|
||||||
@@ -291,6 +306,16 @@ new FormModel {
|
|||||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||||
"value": "cell 6 6"
|
"value": "cell 6 6"
|
||||||
} )
|
} )
|
||||||
|
add( new FormComponent( "javax.swing.JComboBox" ) {
|
||||||
|
name: "comboBox22"
|
||||||
|
"$client.JComponent.roundRect": true
|
||||||
|
"editable": true
|
||||||
|
auxiliary() {
|
||||||
|
"JavaCodeGenerator.typeParameters": "String"
|
||||||
|
}
|
||||||
|
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||||
|
"value": "cell 7 6"
|
||||||
|
} )
|
||||||
add( new FormComponent( "javax.swing.JLabel" ) {
|
add( new FormComponent( "javax.swing.JLabel" ) {
|
||||||
name: "label6"
|
name: "label6"
|
||||||
"text": "JSpinner:"
|
"text": "JSpinner:"
|
||||||
@@ -404,7 +429,7 @@ new FormModel {
|
|||||||
} )
|
} )
|
||||||
}, new FormLayoutConstraints( null ) {
|
}, new FormLayoutConstraints( null ) {
|
||||||
"location": new java.awt.Point( 0, 0 )
|
"location": new java.awt.Point( 0, 0 )
|
||||||
"size": new java.awt.Dimension( 790, 715 )
|
"size": new java.awt.Dimension( 915, 715 )
|
||||||
} )
|
} )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user