mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2026-02-13 07:17:13 -06:00
ComboBox: made popup list wider if list item texts are longer than combo box width
This commit is contained in:
@@ -341,6 +341,22 @@ public class FlatComboBoxUI
|
||||
super( combo );
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Rectangle computePopupBounds( int px, int py, int pw, int ph ) {
|
||||
// get maximum display size of all items, ignoring prototype value
|
||||
Object prototype = comboBox.getPrototypeDisplayValue();
|
||||
if( prototype != null )
|
||||
comboBox.setPrototypeDisplayValue( null );
|
||||
Dimension displaySize = getDisplaySize();
|
||||
if( prototype != null )
|
||||
comboBox.setPrototypeDisplayValue( prototype );
|
||||
|
||||
// make popup wider if necessary
|
||||
pw = Math.max( pw, displaySize.width );
|
||||
|
||||
return super.computePopupBounds( px, py, pw, ph );
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void configurePopup() {
|
||||
super.configurePopup();
|
||||
|
||||
Reference in New Issue
Block a user