You have to extend the MetalComboBoxUI, you need something like this:
Code:
class MyComboBoxUI extends MetalComboBoxUI {
..............
protected ComboPopup createPopup() {
return new MetalComboPopup(comboBox) {
public void show() {
Dimension popupSize = ((MyComboBox) comboBox).getPopupSize();
//if (popupSize.width < getPopupWidth()) {
// popupSize.width = getPopupWidth();
//}
popupSize.setSize(popupSize.width, getPopupHeightForRowCount(comboBox.getMaximumRowCount()));
Rectangle popupBounds = computePopupBounds(0, comboBox.getBounds().height, popupSize.width, popupSize.height);
scroller.setMaximumSize(popupBounds.getSize());
scroller.setPreferredSize(popupBounds.getSize());
scroller.setMinimumSize(popupBounds.getSize());
list.invalidate();
int selectedIndex = comboBox.getSelectedIndex();
if (selectedIndex == -1) {
list.clearSelection();
} else {
list.setSelectedIndex(selectedIndex);
}
list.ensureIndexIsVisible(list.getSelectedIndex());
setLightWeightPopupEnabled(comboBox.isLightWeightPopupEnabled());
show(comboBox, popupBounds.x, popupBounds.y);
}
};
}
}
or you can use the components TComboBox and SScrolledTable from
eva/3 Application Builder
Best Regards
floaty
Bookmarks