Java 类javax.swing.JCheckBoxMenuItem 实例源码

项目:incubator-netbeans    文件:ActionFactory.java   
public JMenuItem getPopupMenuItem(JTextComponent target) {

    item = new JCheckBoxMenuItem(NbBundle.getBundle(BaseKit.class).
            getString("line-numbers-menuitem"), isLineNumbersVisible());
    item.addItemListener( new ItemListener() {
        public void itemStateChanged(ItemEvent e) {
            actionPerformed(null,null);
        }
    });
    return item;
}
项目:incubator-netbeans    文件:EditorOnlyDisplayer.java   
private static boolean setShowEditorToolbar( boolean show ) {
    boolean res = true;
    Action toggleEditorToolbar = FileUtil.getConfigObject( "Editors/Actions/toggle-toolbar.instance", Action.class ); //NOI18N
    if( null != toggleEditorToolbar ) {
        if( toggleEditorToolbar instanceof Presenter.Menu ) {
            JMenuItem menuItem = ((Presenter.Menu)toggleEditorToolbar).getMenuPresenter();
            if( menuItem instanceof JCheckBoxMenuItem ) {
                JCheckBoxMenuItem checkBoxMenu = ( JCheckBoxMenuItem ) menuItem;
                res = checkBoxMenu.isSelected();
                if( checkBoxMenu.isSelected() != show ) {
                    try {
                        toggleEditorToolbar.actionPerformed( new ActionEvent( menuItem, 0, "")); //NOII18N
                    } catch( Exception ex ) {
                        //don't worry too much if it isn't working, we're just trying to be helpful here
                        Logger.getLogger( EditorOnlyDisplayer.class.getName()).log( Level.FINE, null, ex );
                    }
                }
            }
        }
    }

    return res;
}
项目:incubator-netbeans    文件:AbstractQuickSearchComboBar.java   
protected void maybeShowPopup (MouseEvent evt) {
    if (evt != null && !SwingUtilities.isLeftMouseButton(evt)) {
        return;
    }

    JPopupMenu pm = new JPopupMenu();
    final Set<ProviderModel.Category> evalCats =
            new LinkedHashSet<ProviderModel.Category>();
    evalCats.addAll(CommandEvaluator.getEvalCats());
    JMenuItem allCats = new AllMenuItem(evalCats);
    pm.add(allCats);

    for (ProviderModel.Category cat : ProviderModel.getInstance().getCategories()) {
        if (!CommandEvaluator.RECENT.equals(cat.getName())) {
            JCheckBoxMenuItem item = new CategoryCheckBoxMenuItem(cat,
                    evalCats);
            pm.add(item);
        }
    }

    pm.show(getInnerComponent(), 0, getInnerComponent().getHeight() - 1);
}
项目:incubator-netbeans    文件:FiltersDescriptor.java   
public void actionPerformed(ActionEvent ev) {
    Object source = ev.getSource();
    // react just on submenu items, not on submenu click itself
    if (source instanceof JCheckBoxMenuItem) {
        JCheckBoxMenuItem menuItem = (JCheckBoxMenuItem)source;
        String filterName = (String)(menuItem.getClientProperty(PROP_FILTER_NAME));
        filtersDesc.setSelected(filterName, menuItem.isSelected());
    }
}
项目:cuttlefish    文件:ViewMenu.java   
private void initialize() {
    mouseToolbarCheckbox = new JCheckBoxMenuItem("Mouse toolbar");
    zoomToolbarCheckbox = new JCheckBoxMenuItem("Zoom toolbar");
    simulationToolbarCheckbox = new JCheckBoxMenuItem("Simulation toolbar");
    dbToolbarCheckbox = new JCheckBoxMenuItem("Explore toolbar");
    undoToolbarCheckbox = new JCheckBoxMenuItem("Undo/Redo toolbar");
    undoToolbarCheckbox.setSelected(true);

    mouseToolbarCheckbox.addItemListener(this);
    zoomToolbarCheckbox.addItemListener(this);
    simulationToolbarCheckbox.addItemListener(this);
    dbToolbarCheckbox.addItemListener(this);
    undoToolbarCheckbox.addItemListener(this);

    this.add(mouseToolbarCheckbox);
    this.add(zoomToolbarCheckbox);
    this.add(simulationToolbarCheckbox);
    this.add(dbToolbarCheckbox);
    this.add(undoToolbarCheckbox);

}
项目:incubator-netbeans    文件:NbEditorKit.java   
public @Override JMenuItem getPopupMenuItem(JTextComponent target) {
    Preferences prefs = MimeLookup.getLookup(MimePath.EMPTY).lookup(Preferences.class);
    boolean toolbarVisible = prefs.getBoolean(SimpleValueNames.TOOLBAR_VISIBLE_PROP, EditorPreferencesDefaults.defaultToolbarVisible);

    JCheckBoxMenuItem item = new JCheckBoxMenuItem(
        NbBundle.getBundle(ToggleToolbarAction.class).getString("PROP_base_toolbarVisible"), //NOI18N
        toolbarVisible);

    item.addItemListener( new ItemListener() {
        public @Override void itemStateChanged(ItemEvent e) {
            actionPerformed(null,null);
        }
    });

    return item;
}
项目:rapidminer    文件:ConfigureDataTableHeader.java   
/**
 * @return menu that allows to select possible column types
 */
private JMenu createTypeMenu() {
    ButtonGroup typeGroup = new ButtonGroup();
    JMenu typeChangeItem = new JMenu(CHANGE_TYPE_LABEL);
    typeChangeItem.setToolTipText(CHANGE_TYPE_TIP);
    for (final ColumnType columnType : ColumnType.values()) {
        final JCheckBoxMenuItem checkboxItem = new JCheckBoxMenuItem(
                DataImportWizardUtils.getNameForColumnType(columnType));
        if (columnType == metaData.getColumnMetaData(columnIndex).getType()) {
            checkboxItem.setSelected(true);
        }
        checkboxItem.addItemListener(new ItemListener() {

            @Override
            public void itemStateChanged(ItemEvent e) {
                if (e.getStateChange() == ItemEvent.SELECTED) {
                    changeType(columnType);
                }

            }
        });
        typeGroup.add(checkboxItem);
        typeChangeItem.add(checkboxItem);
    }
    return typeChangeItem;
}
项目:geomapapp    文件:MapLocations.java   
void initMenu() {
    addLoc = new JMenuItem("Add Place");
    menu.add( addLoc );
    addLoc.addActionListener( this );
    loadLoc = new JMenuItem("Load Places");
    menu.add( loadLoc );
    loadLoc.addActionListener( this );
    editLoc = new JMenuItem("Edit Places");
    menu.add( editLoc );
    editLoc.addActionListener( this );
    editLoc.setEnabled(false);
    showLoc = new JCheckBoxMenuItem("Show Places", false);
    menu.add( showLoc );
    showLoc.addActionListener( this );
//  showLoc.setEnabled(false);
    menu.addSeparator();
    list = new JCheckBox("add to list", true);
    save = new JCheckBox("save to file", false);
    newSave = new JCheckBox("save to new file", false);
    addPresetLocations();
//  addMyLocations();
}
项目:JAddOn    文件:JLogger.java   
/**
 * Return the jcheckboxmenuitem to get added for a menubar
 * @param c Component Location
 * @return JCheckBoxMenuItem
 */
public JCheckBoxMenuItem getJCheckBoxMenuItem(Component c) {
    JCheckBoxMenuItem cbmi = new JCheckBoxMenuItem("Show Console");
    cbmi.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            if(cbmi.isSelected()) {
                reShowConsole(c);
            } else {
                hideConsole();
            }
        }

    });
    menucheckboxitems.add(cbmi);
    return cbmi;
}
项目:JavaGraph    文件:Options.java   
/**
 * Adds a checkbox item with a given name to the options, and returns the
 * associated (fresh) menu item.
 * @param name the name of the checkbox menu item to add
 * @return the added {@link javax.swing.JCheckBoxMenuItem}
 */
private final JCheckBoxMenuItem addCheckbox(final String name) {
    JCheckBoxMenuItem result = new JCheckBoxMenuItem(name);
    boolean selected = userPrefs.getBoolean(name, boolOptionDefaults.get(name));
    boolean enabled = isEnabled(name);
    result.setSelected(selected & enabled);
    this.itemMap.put(name, result);
    if (enabled) {
        result.addItemListener(new ItemListener() {
            @Override
            public void itemStateChanged(ItemEvent e) {
                userPrefs.putBoolean(name, e.getStateChange() == ItemEvent.SELECTED);
            }
        });
    } else {
        result.setEnabled(false);
    }
    return result;
}
项目:KeysPerSecond    文件:Menu.java   
/**
 * Paints a menu item
 * @param g The graphics to use
 * @param menuItem The menu item to paint
 * @param hasCursor Whether or not the cursor is over the component
 * @param defaultTextIconGap The gap between the text and the icon
 */
private static final void paintMenuItem(Graphics2D g, JMenuItem menuItem, boolean hasCursor, int defaultTextIconGap){
    g.setColor(Main.config.customColors ? Main.config.background : Color.BLACK);
    g.fillRect(0, 0, menuItem.getWidth(), menuItem.getHeight());
    if(menuItem instanceof JCheckBoxMenuItem && menuItem.isSelected()){
        g.drawImage(ColorManager.checkmark, 0, 0, 22, 22, 0, 0, 100, 100, menuItem);
    }else if(menuItem instanceof JMenu){
        g.drawImage(ColorManager.arrow, menuItem.getWidth() - 12, 5, menuItem.getWidth(), 17, 0, 0, 128, 128, menuItem);
    }
    g.setColor(Main.config.customColors ? Main.config.foreground : Color.CYAN);
    if(hasCursor){
        g.drawLine(0, 0, menuItem.getWidth(), 0);
        g.drawLine(0, menuItem.getHeight() - 1, menuItem.getWidth(), menuItem.getHeight() - 1);
        Composite prev = g.getComposite();
        g.setComposite(MenuItemUI.mode);
        g.fillRect(0, 0, menuItem.getWidth(), menuItem.getHeight());
        g.setComposite(prev);
    }
    FontMetrics fm = SwingUtilities2.getFontMetrics(menuItem, g);
    int mnemIndex = menuItem.getDisplayedMnemonicIndex();
    int y = (22 - fm.getHeight()) / 2;
    SwingUtilities2.drawStringUnderlineCharAt(menuItem, g, menuItem.getText(), mnemIndex, 22 + defaultTextIconGap, y + fm.getAscent());
}
项目:jaer    文件:MultiUDPNetworkDVS128Camera.java   
public MultiUDPNetworkDVS128Camera() {
      setName("MultiUDPNetworkDVS128Camera");

      setSizeX(MAX_NUM_CAMERAS * 128);
      setSizeY(128);
      setEventExtractor(new Extractor(this));
      chipMenu = new JMenu("MultiCamera");
      chipMenu.getPopupMenu().setLightWeightPopupEnabled(false);
      chipMenu.add(new JMenuItem(new ShowClientMapperAction()));
      loadClientMappingPrefs();
      displayMethod=new MultiUDPNetworkDVS128CameraDisplayMethod(getCanvas());
      getCanvas().addDisplayMethod(displayMethod);
      getCanvas().setDisplayMethod(displayMethod);
      chipMenu.add(new JCheckBoxMenuItem(new DisplayCameraInfoAction(displayMethod)));
chipMenu.add(new JMenuItem(new ShowPowerSettingsAction()));
      activateCameras();
}
项目:JITRAX    文件:MenuBar.java   
private void buildViewMenu() {

    ButtonGroup buttonGroup = new ButtonGroup();

    setCodeHMenu(new JMenu("Code highlighting"));
    raCodeHighLighting = new JCheckBoxMenuItem("Relational Algebra", true);
    sqlCodeHighLighting = new JCheckBoxMenuItem("SQL", true);

    getCodeHMenu().add(raCodeHighLighting);
    getCodeHMenu().add(sqlCodeHighLighting);

    setShowMenu(new JMenu("Show"));
    consoleShow = new JCheckBoxMenuItem("Console", true);
    dbViewerShow = new JCheckBoxMenuItem("DB Viewer", true);
    queriesListShow = new JCheckBoxMenuItem("Query List", true);

    getShowMenu().add(dbViewerShow);
    getShowMenu().add(queriesListShow);
    getShowMenu().add(consoleShow);

    setViewMenu(new JMenu());
    getViewMenu().setMnemonic(KeyEvent.VK_V);
    getViewMenu().add(getCodeHMenu());
    getViewMenu().add(getShowMenu());
}
项目:cuttlefish    文件:ViewMenu.java   
private void initialize() {
    mouseToolbarCheckbox = new JCheckBoxMenuItem("Mouse toolbar");
    zoomToolbarCheckbox = new JCheckBoxMenuItem("Zoom toolbar");
    simulationToolbarCheckbox = new JCheckBoxMenuItem("Simulation toolbar");
    dbToolbarCheckbox = new JCheckBoxMenuItem("Explore toolbar");
    undoToolbarCheckbox = new JCheckBoxMenuItem("Undo/Redo toolbar");
    undoToolbarCheckbox.setSelected(true);

    mouseToolbarCheckbox.addItemListener(this);
    zoomToolbarCheckbox.addItemListener(this);
    simulationToolbarCheckbox.addItemListener(this);
    dbToolbarCheckbox.addItemListener(this);
    undoToolbarCheckbox.addItemListener(this);

    this.add(mouseToolbarCheckbox);
    this.add(zoomToolbarCheckbox);
    this.add(simulationToolbarCheckbox);
    this.add(dbToolbarCheckbox);
    this.add(undoToolbarCheckbox);


}
项目:jdk8u-jdk    文件:bug8031573.java   
@Override
public void init() {
    try {
        SwingUtilities.invokeAndWait(new Runnable() {

            @Override
            public void run() {
                JMenuBar bar = new JMenuBar();
                JMenu menu = new JMenu("Menu");
                JCheckBoxMenuItem checkBoxMenuItem
                        = new JCheckBoxMenuItem("JCheckBoxMenuItem");
                checkBoxMenuItem.setSelected(true);
                menu.add(checkBoxMenuItem);
                bar.add(menu);
                setJMenuBar(bar);
            }
        });
    } catch (Exception e) {
        throw new RuntimeException(e);
    }
}
项目:openjdk-jdk10    文件:bug8031573.java   
@Override
public void init() {
    try {

        UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());

        SwingUtilities.invokeAndWait(new Runnable() {

            @Override
            public void run() {
                JMenuBar bar = new JMenuBar();
                JMenu menu = new JMenu("Menu");
                JCheckBoxMenuItem checkBoxMenuItem
                        = new JCheckBoxMenuItem("JCheckBoxMenuItem");
                checkBoxMenuItem.setSelected(true);
                menu.add(checkBoxMenuItem);
                bar.add(menu);
                setJMenuBar(bar);
            }
        });
    } catch (Exception e) {
        throw new RuntimeException(e);
    }
}
项目:incubator-netbeans    文件:DropTargetLayer.java   
private static boolean hasRadioOrCheckSibling(JMenuItem item) {
    if(item.getParent() == null) return false;
    for(Component c : item.getParent().getComponents()) {
        if(c instanceof JRadioButtonMenuItem) return true;
        if(c instanceof JCheckBoxMenuItem) return true;
    }
    return false;
}
项目:incubator-netbeans    文件:MenuEditLayer.java   
private String getComponentDefaultsPrefix(JComponent c) {
    if(c instanceof JMenuBar) {
        return "MenuBar"; // NOI18N
    }
    if(c instanceof JMenu) {
        return "Menu"; // NOI18N
    }
    if(c instanceof JCheckBoxMenuItem) {
        return "CheckBoxMenuItem"; // NOI18N
    }
    if(c instanceof JRadioButtonMenuItem) {
        return "RadioButtonMenuItem"; // NOI18N
    }
    return "MenuItem"; // NOI18N
}
项目:incubator-netbeans    文件:PresenterEditorAction.java   
private void updateSelectedInPresenters() {
    if (isCheckBox()) {
        boolean selected = isSelected();
        if (menuPresenter instanceof JCheckBoxMenuItem) {
            ((JCheckBoxMenuItem)menuPresenter).setSelected(selected);
        }
        if (popupPresenter instanceof JCheckBoxMenuItem) {
            ((JCheckBoxMenuItem)popupPresenter).setSelected(selected);
        }
    }
}
项目:incubator-netbeans    文件:SyncEditorWithViewsAction.java   
private void createItems() {
    if (menuItems == null) {
        menuItems = new JCheckBoxMenuItem[1];
        menuItems[0] = new JCheckBoxMenuItem(this);
        menuItems[0].setIcon(null);
        Mnemonics.setLocalizedText(menuItems[0],
                NbBundle.getMessage(SyncEditorWithViewsAction.class,
                "CTL_SYNC_EDITOR_WITH_VIEWS"));
    }
}
项目:incubator-netbeans    文件:TestKit.java   
public static void showStatusLabels() {
    JMenuBarOperator mbo = new JMenuBarOperator(MainWindowOperator.getDefault().getJMenuBar());
    JMenuItemOperator mo = mbo.showMenuItem("View|Show Versioning Labels");
    JCheckBoxMenuItemOperator cbmio = new JCheckBoxMenuItemOperator((JCheckBoxMenuItem) mo.getSource());
    if (!cbmio.getState()) {
        cbmio.doClick();
    }
}
项目:incubator-netbeans    文件:TestKit.java   
public static void hideStatusLabels() {
    JMenuBarOperator mbo = new JMenuBarOperator(MainWindowOperator.getDefault().getJMenuBar());
    JMenuItemOperator mo = mbo.showMenuItem("View|Show Versioning Labels");
    JCheckBoxMenuItemOperator cbmio = new JCheckBoxMenuItemOperator((JCheckBoxMenuItem) mo.getSource());
    if (cbmio.getState()) {
        cbmio.doClick();
    }
}
项目:incubator-netbeans    文件:FilterSubmenuAction.java   
public void actionPerformed(ActionEvent ev) {
    Object source = ev.getSource();
    // react just on submenu items, not on submenu click itself
    if (source instanceof JCheckBoxMenuItem) {
        JCheckBoxMenuItem menuItem = (JCheckBoxMenuItem)source;
        String filterName = (String)(menuItem.getClientProperty(PROP_FILTER_NAME));
        filters.getInstance().setSelected(filterName, menuItem.isSelected());
    }
}
项目:incubator-netbeans    文件:TestKit.java   
public static void showStatusLabels() {
    JMenuBarOperator mbo = new JMenuBarOperator(MainWindowOperator.getDefault().getJMenuBar());
    JMenuItemOperator mo = mbo.showMenuItem("View|Show Versioning Labels");
    JCheckBoxMenuItemOperator cbmio = new JCheckBoxMenuItemOperator((JCheckBoxMenuItem) mo.getSource());
    if (!cbmio.getState())
        cbmio.doClick();
}
项目:incubator-netbeans    文件:FilterSubmenuAction.java   
public void actionPerformed(ActionEvent ev) {
    Object source = ev.getSource();
    // react just on submenu items, not on submenu click itself
    if (source instanceof JCheckBoxMenuItem) {
        JCheckBoxMenuItem menuItem = (JCheckBoxMenuItem)source;
        String filterName = (String)(menuItem.getClientProperty(PROP_FILTER_NAME));
        filters.setSelected(filterName, menuItem.isSelected());
    }
}
项目:incubator-netbeans    文件:DropdownButton.java   
private void addAction(JPopupMenu popup, Action action) {
    if (action == null) {
        popup.addSeparator();
    } else {
        Class cls = (Class)action.getValue(KEY_CLASS);
        if (Boolean.class.equals(cls)) {
            Boolean boolvalue = (Boolean)action.getValue(KEY_BOOLVALUE);
            JCheckBoxMenuItem item = new JCheckBoxMenuItem(action);
            item.setSelected(boolvalue);
            popup.add(item);
        } else {
            popup.add(action);
        }
    }
}
项目:incubator-netbeans    文件:ShowEditorOnlyAction.java   
private void createItems() {
    synchronized( this ) {
        if (menuItems == null) {
            menuItems = new JCheckBoxMenuItem[1];
            menuItems[0] = new JCheckBoxMenuItem(this);
            menuItems[0].setIcon(null);
            Mnemonics.setLocalizedText(menuItems[0], NbBundle.getMessage( ShowEditorOnlyAction.class, "CTL_ShowOnlyEditor"));
        }
    }
}
项目:incubator-netbeans    文件:ToggleFullScreenAction.java   
private void createItems() {
    synchronized( this ) {
        if (menuItems == null) {
            menuItems = new JCheckBoxMenuItem[1];
            menuItems[0] = new JCheckBoxMenuItem(this);
            menuItems[0].setIcon(null);
            Mnemonics.setLocalizedText(menuItems[0], NbBundle.getMessage(ToggleFullScreenAction.class, "CTL_ToggleFullScreenAction"));
        }
    }
}
项目:incubator-netbeans    文件:Terminal.java   
private void addMenuItem(JPopupMenu menu, Object o) {
    if (o instanceof JSeparator) {
        menu.add((JSeparator) o);
    } else if (o instanceof Action) {
        Action a = (Action) o;
        if (isBooleanStateAction(a)) {
            JCheckBoxMenuItem item = new JCheckBoxMenuItem(a);
            item.setSelected((Boolean) a.getValue(BOOLEAN_STATE_ENABLED_KEY));
            menu.add(item);
        } else {
            menu.add((Action) o);
        }
    }
}
项目:incubator-netbeans    文件:FieldsBrowserControllerUI.java   
private void addMenuItemListener(final JCheckBoxMenuItem menuItem) {
    final boolean[] internalChange = new boolean[1];
    menuItem.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent e) {
            if (internalChange[0]) return;
            final int column = Integer.parseInt(e.getActionCommand());
            if (column == 5 && !fieldsListTableModel.isRealColumnVisible(column)) {
                BrowserUtils.performTask(new Runnable() {
                    public void run() {
                        final int retainedSizesState = fieldsBrowserController.getInstancesControllerHandler().
                                getHeapFragmentWalker().computeRetainedSizes(false, true);
                        SwingUtilities.invokeLater(new Runnable() {
                            public void run() {
                                if (retainedSizesState != HeapFragmentWalker.RETAINED_SIZES_COMPUTED) {
                                    internalChange[0] = true;
                                    menuItem.setSelected(!menuItem.isSelected());
                                    internalChange[0] = false;
                                } else {
                                    fieldsListTableModel.setRealColumnVisibility(column,
                                            !fieldsListTableModel.isRealColumnVisible(column));
                                    fieldsListTable.createDefaultColumnsFromModel();
                                    fieldsListTable.updateTreeTableHeader();
                                    setColumnsData();
                                }
                            }
                        });
                    }
                });
            } else {
                fieldsListTableModel.setRealColumnVisibility(column,
                        !fieldsListTableModel.isRealColumnVisible(column));
                fieldsListTable.createDefaultColumnsFromModel();
                fieldsListTable.updateTreeTableHeader();
                setColumnsData();
            }
        }
    });
}
项目:incubator-netbeans    文件:ReferencesBrowserControllerUI.java   
private void addMenuItemListener(final JCheckBoxMenuItem menuItem) {
    final boolean[] internalChange = new boolean[1];
    menuItem.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent e) {
            if (internalChange[0]) return;
            final int column = Integer.parseInt(e.getActionCommand());
            if (column == 5 && !fieldsListTableModel.isRealColumnVisible(column)) {
                BrowserUtils.performTask(new Runnable() {
                    public void run() {
                        final int retainedSizesState = referencesBrowserController.getReferencesControllerHandler().
                                getHeapFragmentWalker().computeRetainedSizes(false, true);
                        SwingUtilities.invokeLater(new Runnable() {
                            public void run() {
                                if (retainedSizesState != HeapFragmentWalker.RETAINED_SIZES_COMPUTED) {
                                    internalChange[0] = true;
                                    menuItem.setSelected(!menuItem.isSelected());
                                    internalChange[0] = false;
                                } else {
                                    fieldsListTableModel.setRealColumnVisibility(column,
                                            !fieldsListTableModel.isRealColumnVisible(column));
                                    fieldsListTable.createDefaultColumnsFromModel();
                                    fieldsListTable.updateTreeTableHeader();
                                    setColumnsData();
                                }
                            }
                        });
                    }
                });
            } else {
                fieldsListTableModel.setRealColumnVisibility(column,
                        !fieldsListTableModel.isRealColumnVisible(column));
                fieldsListTable.createDefaultColumnsFromModel();
                fieldsListTable.updateTreeTableHeader();
                setColumnsData();
            }
        }
    });
}
项目:openjdk-jdk10    文件:JCheckBoxMenuItemOperator.java   
@Override
public boolean checkComponent(Component comp) {
    if (comp instanceof JCheckBoxMenuItem) {
        if (((JCheckBoxMenuItem) comp).getText() != null) {
            return (comparator.equals(((JCheckBoxMenuItem) comp).getText(),
                    label));
        }
    }
    return false;
}
项目:xdman    文件:XDMMenuItemUI.java   
@Override
protected void paintBackground(Graphics g, JMenuItem menuItem, Color bgColor) {
    ButtonModel model = menuItem.getModel();
    Color oldColor = g.getColor();
    int menuWidth = menuItem.getWidth();
    int menuHeight = menuItem.getHeight();

    g.setColor(colorBg);
    g.fillRect(0, 0, menuWidth, menuHeight);

    if (model.isArmed()
            || (menuItem instanceof JMenu && model.isSelected())) {
        paintButtonPressed(g, menuItem);
    } else {
        // if (menuItem.getIcon() != null) {
        // int gap = menuItem.getIcon().getIconWidth() + 2;
        // g.setColor(this.darkColor);
        // g.drawLine(gap, 0, gap, menuItem.getHeight());
        // g.setColor(this.lightColor);
        // g.drawLine(gap + 1, 0, gap + 1, menuItem.getHeight());
        // }
    }

    if (menuItem instanceof JCheckBoxMenuItem) {
        if (((JCheckBoxMenuItem) menuItem).isSelected()) {
            // chkIcon.paintIcon(menuItem, g, 5, 5);
        }
    }

    g.setColor(oldColor);
}
项目:geomapapp    文件:MapApp.java   
public void deselectDSDP() {
    if ( XML_Menu.commandToMenuItemHash != null &&
            XML_Menu.commandToMenuItemHash.containsKey("seafloor_driling_cmd") &&
            ((JCheckBoxMenuItem)XML_Menu.commandToMenuItemHash.get("seafloor_driling_cmd")).isSelected()) {
        ((JCheckBoxMenuItem)XML_Menu.commandToMenuItemHash.get("seafloor_driling_cmd")).setSelected(false);
    }
}
项目:incubator-netbeans    文件:FilterActions.java   
public void actionPerformed(ActionEvent ev) {
    Object source = ev.getSource();
    // react just on submenu items, not on submenu click itself
    if (source instanceof JCheckBoxMenuItem) {
        JCheckBoxMenuItem menuItem = (JCheckBoxMenuItem)source;
        String filterName = (String)(menuItem.getClientProperty(PROP_FILTER_NAME));
        filters.setSelected(filterName, menuItem.isSelected());
    }
}
项目:FreeCol    文件:DisplayGridAction.java   
/**
 * {@inheritDoc}
 */
@Override
public void actionPerformed(ActionEvent ae) {
    setSelected(((JCheckBoxMenuItem)ae.getSource()).isSelected());
    setOption(isSelected());
    getGUI().refresh();
}
项目:incubator-netbeans    文件:TestKit.java   
public static void showStatusLabels() {
    JMenuBarOperator mbo = new JMenuBarOperator(MainWindowOperator.getDefault().getJMenuBar());
    JMenuItemOperator mo = mbo.showMenuItem("View|Show Versioning Labels");
    JCheckBoxMenuItemOperator cbmio = new JCheckBoxMenuItemOperator((JCheckBoxMenuItem) mo.getSource());
    if (!cbmio.getState()) {
        cbmio.doClick();
    }
}
项目:incubator-netbeans    文件:NbMenuItem.java   
/**
     * @param it
     * @return instance of NbMenuItem constructed from parameter it */
    public NbMenuItem(JMenuItem it) {
        setName(it.getText());//getLabel();
        this.accelerator = (it.getAccelerator() == null) ? null : it.getAccelerator().toString();
        this.mnemo = (char) it.getMnemonic();
//        System.out.println("NbMenuItem ["+name+"] - mnemo: ["+it.getMnemonic()+"]"); why are the mnemonic always in capital?
        this.enabled = it.isEnabled();
        this.checkbox = it instanceof JCheckBoxMenuItem;
        this.radiobutton = it instanceof JRadioButtonMenuItem;
        this.checked = it.isSelected();
    }
项目:incubator-netbeans    文件:NbMenuItem.java   
/**
     * @param it
     * @return instance of NbMenuItem constructed from parameter it */
    public NbMenuItem(JMenuItem it) {
        setName(it.getText());//getLabel();
        this.accelerator = (it.getAccelerator() == null) ? null : it.getAccelerator().toString();
        this.mnemo = (char) it.getMnemonic();
//        System.out.println("NbMenuItem ["+name+"] - mnemo: ["+it.getMnemonic()+"]"); why are the mnemonic always in capital?
        this.enabled = it.isEnabled();
        this.checkbox = it instanceof JCheckBoxMenuItem;
        this.radiobutton = it instanceof JRadioButtonMenuItem;
        this.checked = it.isSelected();
    }
项目:rapidminer    文件:FileTable.java   
private void initPopupMenu() {
    this.panePopup = this.fileList.getPanePopup();

    this.headerPopup = new JPopupMenu();

    String col = "";
    this.en = this.columnNames.elements();
    while (this.en.hasMoreElements()) {
        col = this.en.nextElement().toString();
        this.menuItem = new JCheckBoxMenuItem(col);
        this.menuItem.setSelected(true);
        this.menuItem.addActionListener(this.hal);
        this.headerPopup.add(this.menuItem);
    }
}