mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2026-02-12 23:07:15 -06:00
ComboBox: made popup list wider if list item texts are longer than combo box width
This commit is contained in:
@@ -75,6 +75,7 @@ public class FlatComponentsTest
|
||||
JComboBox<String> comboBox2 = new JComboBox<>();
|
||||
JComboBox<String> comboBox3 = new JComboBox<>();
|
||||
JComboBox<String> comboBox4 = new JComboBox<>();
|
||||
JComboBox<String> comboBox5 = new JComboBox<>();
|
||||
JLabel spinnerLabel = new JLabel();
|
||||
JSpinner spinner1 = new JSpinner();
|
||||
JSpinner spinner2 = new JSpinner();
|
||||
@@ -365,6 +366,16 @@ public class FlatComponentsTest
|
||||
comboBox4.setEnabled(false);
|
||||
add(comboBox4, "cell 4 5,growx");
|
||||
|
||||
//---- comboBox5 ----
|
||||
comboBox5.setPrototypeDisplayValue("12345");
|
||||
comboBox5.setModel(new DefaultComboBoxModel<>(new String[] {
|
||||
"wide popup if text is longer",
|
||||
"aa",
|
||||
"bbb",
|
||||
"cccc"
|
||||
}));
|
||||
add(comboBox5, "cell 5 5,growx");
|
||||
|
||||
//---- spinnerLabel ----
|
||||
spinnerLabel.setText("JSpinner:");
|
||||
add(spinnerLabel, "cell 0 6");
|
||||
|
||||
@@ -240,6 +240,19 @@ new FormModel {
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 4 5,growx"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JComboBox" ) {
|
||||
name: "comboBox5"
|
||||
"prototypeDisplayValue": "12345"
|
||||
"model": new javax.swing.DefaultComboBoxModel {
|
||||
selectedItem: "wide popup if text is longer"
|
||||
addElement( "wide popup if text is longer" )
|
||||
addElement( "aa" )
|
||||
addElement( "bbb" )
|
||||
addElement( "cccc" )
|
||||
}
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 5 5,growx"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JLabel" ) {
|
||||
name: "spinnerLabel"
|
||||
"text": "JSpinner:"
|
||||
|
||||
Reference in New Issue
Block a user