-
Enhancement
-
Resolution: Unresolved
-
P4
-
None
-
generic
-
generic
ADDITIONAL SYSTEM INFORMATION :
java version "23.0.1" 2024-10-15
Java(TM) SE Runtime Environment (build 23.0.1+11-39)
Java HotSpot(TM) 64-Bit Server VM (build 23.0.1+11-39, mixed mode, sharing)
A DESCRIPTION OF THE PROBLEM :
JComboBox popup width does not expand properly when using AbsoluteLayout and custom cell rendering (see attached example). It would be desirable that JComboBox could expand properly independently of the Layout.
----------- BEGIN SOURCE -----------
import javax.swing.*;
import java.awt.*;
public class ComboBoxBugExample {
public static void main(String[] args) {
SwingUtilities.invokeLater(() -> {
JFrame frame = new JFrame("Bug Example");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setLayout(null);
JComboBox<String> comboBox = new JComboBox<>(new String[]{
"Short",
"A much longer item to test",
"The longest item in the combo box"
});
comboBox.setBounds(50, 50, 150, 30);
comboBox.setPrototypeDisplayValue("The longest item in the combo box");
frame.add(comboBox);
frame.setSize(400, 300);
frame.setVisible(true);
});
}
}
----------- END SOURCE -----------
java version "23.0.1" 2024-10-15
Java(TM) SE Runtime Environment (build 23.0.1+11-39)
Java HotSpot(TM) 64-Bit Server VM (build 23.0.1+11-39, mixed mode, sharing)
A DESCRIPTION OF THE PROBLEM :
JComboBox popup width does not expand properly when using AbsoluteLayout and custom cell rendering (see attached example). It would be desirable that JComboBox could expand properly independently of the Layout.
----------- BEGIN SOURCE -----------
import javax.swing.*;
import java.awt.*;
public class ComboBoxBugExample {
public static void main(String[] args) {
SwingUtilities.invokeLater(() -> {
JFrame frame = new JFrame("Bug Example");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setLayout(null);
JComboBox<String> comboBox = new JComboBox<>(new String[]{
"Short",
"A much longer item to test",
"The longest item in the combo box"
});
comboBox.setBounds(50, 50, 150, 30);
comboBox.setPrototypeDisplayValue("The longest item in the combo box");
frame.add(comboBox);
frame.setSize(400, 300);
frame.setVisible(true);
});
}
}
----------- END SOURCE -----------