How to prevent JPopUpMenu disappearing when checking checkboxes in it?
问题 I want to use JCheckBoxMenuItem s in a JPopupMenu . It works, but the problem is that the popup menu disappears when a checkbox item has been checked or unchecked. So if one wants to check/uncheck several items, the popup needs to be launched repeatedly, which is irritating. Curiously, if I use just plain JCheckBox items in the menu (instead of JCheckBoxMenuItem s), the behavior is just as it should be: the popup stays there and the checkboxes can be checked/unchecked. Once done, the popup