001package jmri.util.swing;
002
003/**
004 * UI for StayOpenCheckBoxItem or JCheckBoxMenuItem.
005 * Does not close menu that the CheckBox is in when set.
006 * JCheckBoxMenuItem items in Popup menus require this UI to stay open.
007 * 
008 * Does NOT work with Nimbus LAF, does not display checked check-boxes.
009 * 
010 * @author Steve Young (C) 2021
011 */
012public class StayOpenCheckBoxMenuItemUI extends javax.swing.plaf.basic.BasicCheckBoxMenuItemUI {
013
014    @Override
015    protected void doClick(javax.swing.MenuSelectionManager msm) {
016        menuItem.doClick(0);
017    }
018
019    public static javax.swing.plaf.ComponentUI createUI(javax.swing.JComponent c) {
020        return new StayOpenCheckBoxMenuItemUI();
021    }
022}