JComboBox displays a List on click. Instead of the list, I want to display a JPopupMenu.
In the following code the event is triggered but the popup doesnt show up. Why?
JComboBox box = new JComboBox();
box.addPopupMenuListener(new PopupMenuListener() {
@Override
public void popupMenuWillBecomeVisible(PopupMenuEvent e) {
popupMenu.show(box, 0, box.getHeight());
}
...
});
Alternatively one can use a mouseListener. Due to a JDK-bug https://bugs.java.com/bugdatabase/view_bug.do?bug_id=4144505 one has to add the mouseListener to all Descendants like that: