I've been using this for checkbox items:
import javax.swing.JCheckBoxMenuItem;
import javax.swing.JComponent;
import javax.swing.MenuSelectionManager;
import javax.swing.plaf.ComponentUI;
import javax.swing.plaf.basic.BasicCheckBoxMenuItemUI;
public class StayOpenCheckBoxMenuItemUI extends BasicCheckBoxMenuItemUI {
@Override
protected void doClick(MenuSelectionManager msm) {
menuItem.doClick(0);
}
public static ComponentUI createUI(JComponent c) {
return new StayOpenCheckBoxMenuItemUI();
}
}
Then, register it:
myJCheckBoxMenuItem.setUI(new StayOpenCheckBoxMenuItemUI());
Depending on what type of menu item your 'Show more' item is, similar solution should work. Just subclass the proper UI instead of BasicCheckBoxMenuItemUI
.