mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2026-02-12 15:07:11 -06:00
ComboBox: made popup list wider if list item texts are longer than combo box width
This commit is contained in:
@@ -54,6 +54,7 @@ class BasicComponentsPanel
|
||||
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();
|
||||
@@ -264,6 +265,16 @@ class BasicComponentsPanel
|
||||
comboBox4.setEnabled(false);
|
||||
add(comboBox4, "cell 4 4,growx");
|
||||
|
||||
//---- comboBox5 ----
|
||||
comboBox5.setPrototypeDisplayValue("12345");
|
||||
comboBox5.setModel(new DefaultComboBoxModel<>(new String[] {
|
||||
"wide popup if text is longer",
|
||||
"aa",
|
||||
"bbb",
|
||||
"cccc"
|
||||
}));
|
||||
add(comboBox5, "cell 5 4,growx");
|
||||
|
||||
//---- spinnerLabel ----
|
||||
spinnerLabel.setText("JSpinner:");
|
||||
add(spinnerLabel, "cell 0 5");
|
||||
|
||||
@@ -199,6 +199,19 @@ new FormModel {
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 4 4,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 4,growx"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JLabel" ) {
|
||||
name: "spinnerLabel"
|
||||
"text": "JSpinner:"
|
||||
|
||||
Reference in New Issue
Block a user