/** * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent) */ @Override public void actionPerformed(ActionEvent e) { if (e.getSource() == menuItemWatch) { watchToggle.setSelected(menuItemWatch.getState()); } else { menuItemWatch.setState(watchToggle.isSelected()); } }
boolean state = ((JCheckBoxMenuItem)e.getSource()).getState(); if (GCPreferences.SHOW_MODEL_METRICS_PANEL.equals(e.getActionCommand())) { gui.getSelectedGCDocument().setShowModelMetricsPanel(state);
/** * Copies values that are stored in menu items into <code>GCPreferences</code> instance. * * @param gui source to copy values from * @return <code>GCPreferences</code> with current values */ private GCPreferences copyPreferencesFromGui(GCViewerGui gui) { GCPreferences preferences = gui.getPreferences(); for (Entry<String, JCheckBoxMenuItem> menuEntry : ((GCViewerGuiMenuBar)gui.getJMenuBar()).getViewMenuItems().entrySet()) { JCheckBoxMenuItem item = menuEntry.getValue(); preferences.setGcLineProperty(item.getActionCommand(), item.getState()); } preferences.setWindowWidth(gui.getWidth()); preferences.setWindowHeight(gui.getHeight()); preferences.setWindowX(gui.getX()); preferences.setWindowY(gui.getY()); OpenFile openFileAction = (OpenFile)gui.getActionMap().get(ActionCommands.OPEN_FILE.toString()); if (openFileAction.getLastSelectedFiles().length != 0) { preferences.setLastFile(openFileAction.getLastSelectedFiles()[0].getAbsolutePath()); } // recent files List<String> recentFileList = new LinkedList<String>(); for (GCResourceGroup urlSet : ((GCViewerGuiMenuBar) gui.getJMenuBar()).getRecentGCResourcesModel().getResourceNameGroups()) { recentFileList.add(urlSet.getUrlGroupString()); } preferences.setRecentFiles(recentFileList); return preferences; }
private void viewXMLMenuItemActionPerformed(ActionEvent evt) { JInternalFrame jf = desktopPane.getSelectedFrame(); boolean oldValue = viewXmlMenuItem.getState(); if (jf != null && jf.getContentPane().getComponent(0) instanceof SchemaExplorer) { SchemaExplorer se = (SchemaExplorer) jf.getContentPane().getComponent(0); // Call schema explorer's view xml event and update the workbench's // view menu accordingly' ((JCheckBoxMenuItem) evt.getSource()).setSelected(se.editMode(evt)); return; } viewXmlMenuItem.setSelected(!oldValue); }
popupMenu.add(holdPriorityMenuItem); holdPriorityMenuItem.addActionListener(e -> { boolean holdPriority = ((JCheckBoxMenuItem) e.getSource()).getState(); gamePanel.setMenuStates(manaPoolMenuItem1.getState(), manaPoolMenuItem2.getState(), useFirstManaAbilityItem.getState(), holdPriority); gamePanel.holdPriority(holdPriority); }); boolean manaPoolAutomatic = ((JCheckBoxMenuItem) e.getSource()).getState(); PreferencesDialog.saveValue(KEY_GAME_MANA_AUTOPAYMENT, manaPoolAutomatic ? "true" : "false"); gamePanel.setMenuStates(manaPoolAutomatic, manaPoolMenuItem2.getState(), useFirstManaAbilityItem.getState(), holdPriorityMenuItem.getState()); SessionHandler.sendPlayerAction(manaPoolAutomatic ? PlayerAction.MANA_AUTO_PAYMENT_ON : PlayerAction.MANA_AUTO_PAYMENT_OFF, gameId, null); }); boolean manaPoolAutomaticRestricted = ((JCheckBoxMenuItem) e.getSource()).getState(); PreferencesDialog.saveValue(KEY_GAME_MANA_AUTOPAYMENT_ONLY_ONE, manaPoolAutomaticRestricted ? "true" : "false"); gamePanel.setMenuStates(manaPoolMenuItem1.getState(), manaPoolAutomaticRestricted, useFirstManaAbilityItem.getState(), holdPriorityMenuItem.getState()); SessionHandler.sendPlayerAction(manaPoolAutomaticRestricted ? PlayerAction.MANA_AUTO_PAYMENT_RESTRICTED_ON : PlayerAction.MANA_AUTO_PAYMENT_RESTRICTED_OFF, gameId, null); }); boolean useFirstManaAbility = ((JCheckBoxMenuItem) e.getSource()).getState(); PreferencesDialog.saveValue(KEY_USE_FIRST_MANA_ABILITY, useFirstManaAbility ? "true" : "false"); gamePanel.setMenuStates(manaPoolMenuItem1.getState(), manaPoolMenuItem2.getState(), useFirstManaAbility, holdPriorityMenuItem.getState()); SessionHandler.sendPlayerAction(useFirstManaAbility ? PlayerAction.USE_FIRST_MANA_ABILITY_ON : PlayerAction.USE_FIRST_MANA_ABILITY_OFF, gameId, null); }); boolean requestsAllowed = ((JCheckBoxMenuItem) e.getSource()).getState(); PreferencesDialog.setPrefValue(KEY_GAME_ALLOW_REQUEST_SHOW_HAND_CARDS, requestsAllowed); SessionHandler.sendPlayerAction(requestsAllowed ? PlayerAction.PERMISSION_REQUESTS_ALLOWED_ON : PlayerAction.PERMISSION_REQUESTS_ALLOWED_OFF, gameId, null);
public void actionPerformed(final ActionEvent e) { watchToggle.setSelected(menuItemWatch.getState()); } });
@Override public void itemStateChanged(ItemEvent e) { VisualizationTree.setVisible(context, v, visItem.getState()); } });
@Override public void actionPerformed(ActionEvent e) { logFormatter.setVisible(field, menuItem.getState()); updateFilter(); } });
/** * {@inheritDoc} */ @Override public void actionPerformed( final ActionEvent aEvent ) { final JCheckBoxMenuItem menuItem = ( JCheckBoxMenuItem )aEvent.getSource(); this.controller.setSnapModeEnabled( menuItem.getState() ); }
/** * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent) */ @Override public void actionPerformed( final ActionEvent aEvent ) { final JCheckBoxMenuItem menuItem = ( JCheckBoxMenuItem )aEvent.getSource(); this.controller.setCursorMode( menuItem.getState() ); }
public void actionPerformed(ActionEvent e) { JCheckBoxMenuItem saveonexititem = (JCheckBoxMenuItem) e.getSource(); editorwindow.getSettings().setSaveSettingsOnExit(saveonexititem.getState()); } });
public void actionPerformed(final ActionEvent e) { final GCDocument gcDocument = getSelectedGCDocument(); if (gcDocument != null) { gcDocument.setShowModelPanel(menuItemShowDataPanel.getState()); } } });
/** * Triggered from popup menu. * * @param e menu item event */ @Override public void itemStateChanged (ItemEvent e) { JCheckBoxMenuItem item = (JCheckBoxMenuItem) e.getItem(); Board board = getBoard(item.getText()); board.setSelected(item.getState()); }
/** * Called when a property of an RcObjectMetadataJPanelParameters object has * changed. */ public void objectMetadataJPanelParametersChanged() { if (this.rcObjMdJPanelParams.getDisplayMetsXml() != this.menuBar.displayMetsXmlJCheckboxMenuItem.getState()) { this.menuBar.displayMetsXmlJCheckboxMenuItem.setSelected(this.rcObjMdJPanelParams.getDisplayMetsXml()); } }
public void actionPerformed(final ActionEvent e) { final GCDocument gcDocument = getSelectedGCDocument(); if (gcDocument != null) { gcDocument.getModelChart().setAntiAlias(menuItemAntiAlias.getState()); gcDocument.relayout(); } } });
@Override public void actionPerformed(ActionEvent e) { JCheckBoxMenuItem menuItem = (JCheckBoxMenuItem) e.getSource(); PreferencesManager.getPreferences().setShowAttributeView(menuItem.getState()); IGV.getInstance().getMainPanel().invalidate(); IGV.getInstance().doRefresh(); } };