Name: rl43681 Date: 06/17/2003
A DESCRIPTION OF THE REQUEST :
If you make a combo box 25 pixels wide because you are trying to save screen
space (The real purpose of the JComboBox compared to JList!), the popup will be only 25 pixels wide.
Developers should be able to set the popup menu to its preferredSize or to another different size than the JComboBox.
As there is no good workaround for this (the better one is to extend BasicComboBoxUI), I suggest to add a new method to JComboBox for setting the size of its popup menu.
The real purpose of the JComboBox is to save the space! For the moment we have to either extends the size of our combo boxes, or to extend the Basic UI (which is very ugly and annoying for a multi-LAF application).
I think that extending the popup to its preferred size is perfect, because the popup is temporary.
It wouldn't compromise backward compatibility issue.
EXPECTED VERSUS ACTUAL BEHAVIOR :
Programmer should be able to change the popup menu independently to the JComboBox size itself.
The popup menu is always the size of the JComboBox.
CUSTOMER SUBMITTED WORKAROUND :
class StyledComboBoxUI extends BasicComboBoxUI
protected ComboPopup createPopup()
BasicComboPopup popup = new BasicComboPopup(comboBox)
protected Rectangle computePopupBounds(int px,int py,int pw,int ph)
class StyledComboBox extends JComboBox
setUI( new StyledComboBoxUI() );
(Review ID: 188209)