use of javax.swing.JRadioButtonMenuItem in project keystore-explorer by kaikramer.
the class KseFrame method initMenu.
private void initMenu() {
JMenuBar jmbMenuBar = new JMenuBar();
jmFile = new JMenu(res.getString("KseFrame.jmFile.text"));
PlatformUtil.setMnemonic(jmFile, res.getString("KseFrame.jmFile.mnemonic").charAt(0));
jmiNew = new JMenuItem(newAction);
PlatformUtil.setMnemonic(jmiNew, res.getString("KseFrame.jmiNew.mnemonic").charAt(0));
jmiNew.setToolTipText(null);
new StatusBarChangeHandler(jmiNew, (String) newAction.getValue(Action.LONG_DESCRIPTION), this);
jmFile.add(jmiNew);
jmiOpen = new JMenuItem(openAction);
PlatformUtil.setMnemonic(jmiOpen, res.getString("KseFrame.jmiOpen.mnemonic").charAt(0));
jmiOpen.setToolTipText(null);
new StatusBarChangeHandler(jmiOpen, (String) openAction.getValue(Action.LONG_DESCRIPTION), this);
jmFile.add(jmiOpen);
jmOpenSpecial = new JMenu(res.getString("KseFrame.jmOpenSpecial.text"));
jmOpenSpecial.setIcon(new ImageIcon(Toolkit.getDefaultToolkit().createImage(getClass().getResource("images/menu/openspecial.png"))));
PlatformUtil.setMnemonic(jmOpenSpecial, res.getString("KseFrame.jmOpenSpecial.mnemonic").charAt(0));
jmFile.add(jmOpenSpecial);
jmiOpenDefaultKeyStore = new JMenuItem(openDefaultKeyStoreAction);
PlatformUtil.setMnemonic(jmiOpenDefaultKeyStore, res.getString("KseFrame.jmiOpenDefaultKeyStore.mnemonic").charAt(0));
jmiOpenDefaultKeyStore.setToolTipText(null);
new StatusBarChangeHandler(jmiOpenDefaultKeyStore, (String) openDefaultKeyStoreAction.getValue(Action.LONG_DESCRIPTION), this);
jmOpenSpecial.add(jmiOpenDefaultKeyStore);
jmiOpenCaCertificatesKeyStore = new JMenuItem(openCaCertificatesKeyStoreAction);
PlatformUtil.setMnemonic(jmiOpenCaCertificatesKeyStore, res.getString("KseFrame.jmiOpenCaCertificatesKeyStore.mnemonic").charAt(0));
jmiOpenCaCertificatesKeyStore.setToolTipText(null);
new StatusBarChangeHandler(jmiOpenCaCertificatesKeyStore, (String) openCaCertificatesKeyStoreAction.getValue(Action.LONG_DESCRIPTION), this);
jmOpenSpecial.add(jmiOpenCaCertificatesKeyStore);
jmiOpenPkcs11KeyStore = new JMenuItem(openPkcs11KeyStoreAction);
PlatformUtil.setMnemonic(jmiOpenPkcs11KeyStore, res.getString("KseFrame.jmiOpenPkcs11KeyStore.mnemonic").charAt(0));
jmiOpenPkcs11KeyStore.setToolTipText(null);
new StatusBarChangeHandler(jmiOpenPkcs11KeyStore, (String) openPkcs11KeyStoreAction.getValue(Action.LONG_DESCRIPTION), this);
jmOpenSpecial.add(jmiOpenPkcs11KeyStore);
jmiOpenMsCapiKeyStore = new JMenuItem(openMsCapiAction);
PlatformUtil.setMnemonic(jmiOpenMsCapiKeyStore, res.getString("KseFrame.jmiOpenPkcs11KeyStore.mnemonic").charAt(0));
jmiOpenMsCapiKeyStore.setToolTipText(null);
new StatusBarChangeHandler(jmiOpenMsCapiKeyStore, (String) openMsCapiAction.getValue(Action.LONG_DESCRIPTION), this);
// show menu item for MSCAPI Windows-MY only on Windows
if (OperatingSystem.isWindows()) {
jmOpenSpecial.add(jmiOpenMsCapiKeyStore);
}
jmFile.addSeparator();
jmiClose = new JMenuItem(closeAction);
PlatformUtil.setMnemonic(jmiClose, res.getString("KseFrame.jmiClose.mnemonic").charAt(0));
jmiClose.setToolTipText(null);
new StatusBarChangeHandler(jmiClose, (String) closeAction.getValue(Action.LONG_DESCRIPTION), this);
jmFile.add(jmiClose);
jmiCloseAll = new JMenuItem(closeAllAction);
PlatformUtil.setMnemonic(jmiCloseAll, res.getString("KseFrame.jmiCloseAll.mnemonic").charAt(0));
jmiCloseAll.setToolTipText(null);
new StatusBarChangeHandler(jmiCloseAll, (String) closeAllAction.getValue(Action.LONG_DESCRIPTION), this);
jmFile.add(jmiCloseAll);
jmFile.addSeparator();
jmiSave = new JMenuItem(saveAction);
PlatformUtil.setMnemonic(jmiSave, res.getString("KseFrame.jmiSave.mnemonic").charAt(0));
jmiSave.setToolTipText(null);
new StatusBarChangeHandler(jmiSave, (String) saveAction.getValue(Action.LONG_DESCRIPTION), this);
jmFile.add(jmiSave);
jmiSaveAs = new JMenuItem(saveAsAction);
PlatformUtil.setMnemonic(jmiSaveAs, res.getString("KseFrame.jmiSaveAs.mnemonic").charAt(0));
jmiSaveAs.setDisplayedMnemonicIndex(5);
jmiSaveAs.setToolTipText(null);
new StatusBarChangeHandler(jmiSaveAs, (String) saveAsAction.getValue(Action.LONG_DESCRIPTION), this);
jmFile.add(jmiSaveAs);
jmiSaveAll = new JMenuItem(saveAllAction);
PlatformUtil.setMnemonic(jmiSaveAll, res.getString("KseFrame.jmiSaveAll.mnemonic").charAt(0));
jmiSaveAll.setToolTipText(null);
new StatusBarChangeHandler(jmiSaveAll, (String) saveAllAction.getValue(Action.LONG_DESCRIPTION), this);
jmFile.add(jmiSaveAll);
jmFile.addSeparator();
jmrfRecentFiles = new JMenuRecentFiles(res.getString("KseFrame.jmrfRecentFiles.text"), RECENT_FILES_SIZE);
jmrfRecentFiles.setIcon(new ImageIcon(Toolkit.getDefaultToolkit().createImage(getClass().getResource("images/menu/recentfiles.png"))));
PlatformUtil.setMnemonic(jmrfRecentFiles, res.getString("KseFrame.jmrfRecentFiles.mnemonic").charAt(0));
jmFile.add(jmrfRecentFiles);
File[] recentFiles = applicationSettings.getRecentFiles();
for (int i = recentFiles.length - 1; i >= 0; i--) {
jmrfRecentFiles.add(createRecentFileMenuItem(jmrfRecentFiles, recentFiles[i]));
}
if (!OperatingSystem.isMacOs()) {
jmFile.addSeparator();
jmiExit = new JMenuItem(exitAction);
PlatformUtil.setMnemonic(jmiExit, res.getString("KseFrame.jmiExit.mnemonic").charAt(0));
jmiExit.setToolTipText(null);
new StatusBarChangeHandler(jmiExit, (String) exitAction.getValue(Action.LONG_DESCRIPTION), this);
jmFile.add(jmiExit);
}
jmEdit = new JMenu(res.getString("KseFrame.jmEdit.text"));
PlatformUtil.setMnemonic(jmEdit, res.getString("KseFrame.jmEdit.mnemonic").charAt(0));
jmiUndo = new JMenuItem(undoAction);
PlatformUtil.setMnemonic(jmiUndo, res.getString("KseFrame.jmiUndo.mnemonic").charAt(0));
jmiUndo.setToolTipText(null);
new StatusBarChangeHandler(jmiUndo, (String) undoAction.getValue(Action.LONG_DESCRIPTION), this);
jmEdit.add(jmiUndo);
jmiRedo = new JMenuItem(redoAction);
PlatformUtil.setMnemonic(jmiRedo, res.getString("KseFrame.jmiRedo.mnemonic").charAt(0));
jmiRedo.setToolTipText(null);
new StatusBarChangeHandler(jmiRedo, (String) redoAction.getValue(Action.LONG_DESCRIPTION), this);
jmEdit.add(jmiRedo);
jmEdit.addSeparator();
jmiCut = new JMenuItem(cutAction);
PlatformUtil.setMnemonic(jmiCut, res.getString("KseFrame.jmiCut.mnemonic").charAt(0));
jmiCut.setToolTipText(null);
new StatusBarChangeHandler(jmiCut, (String) cutAction.getValue(Action.LONG_DESCRIPTION), this);
jmEdit.add(jmiCut);
jmiCopy = new JMenuItem(copyAction);
PlatformUtil.setMnemonic(jmiCopy, res.getString("KseFrame.jmiCopy.mnemonic").charAt(0));
jmiCopy.setToolTipText(null);
new StatusBarChangeHandler(jmiCopy, (String) copyAction.getValue(Action.LONG_DESCRIPTION), this);
jmEdit.add(jmiCopy);
jmiPaste = new JMenuItem(pasteAction);
PlatformUtil.setMnemonic(jmiPaste, res.getString("KseFrame.jmiPaste.mnemonic").charAt(0));
jmiPaste.setToolTipText(null);
new StatusBarChangeHandler(jmiPaste, (String) pasteAction.getValue(Action.LONG_DESCRIPTION), this);
jmEdit.add(jmiPaste);
jmEdit.addSeparator();
jmiFind = new JMenuItem(findAction);
PlatformUtil.setMnemonic(jmiFind, res.getString("KseFrame.jmiFind.mnemonic").charAt(0));
jmiFind.setToolTipText(null);
new StatusBarChangeHandler(jmiFind, (String) findAction.getValue(Action.LONG_DESCRIPTION), this);
jmEdit.add(jmiFind);
jmView = new JMenu(res.getString("KseFrame.jmView.text"));
PlatformUtil.setMnemonic(jmView, res.getString("KseFrame.jmView.mnemonic").charAt(0));
boolean showToolBar = applicationSettings.getShowToolBar();
jcbmiShowHideToolBar = new JCheckBoxMenuItem(showHideToolBarAction);
jcbmiShowHideToolBar.setState(showToolBar);
PlatformUtil.setMnemonic(jcbmiShowHideToolBar, res.getString("KseFrame.jcbmiShowHideToolBar.mnemonic").charAt(0));
jcbmiShowHideToolBar.setToolTipText(null);
new StatusBarChangeHandler(jcbmiShowHideToolBar, (String) showHideToolBarAction.getValue(Action.LONG_DESCRIPTION), this);
jmView.add(jcbmiShowHideToolBar);
jcbmiShowHideStatusBar = new JCheckBoxMenuItem(showHideStatusBarAction);
jcbmiShowHideStatusBar.setState(applicationSettings.getShowStatusBar());
PlatformUtil.setMnemonic(jcbmiShowHideStatusBar, res.getString("KseFrame.jcbmiShowHideStatusBar.mnemonic").charAt(0));
jcbmiShowHideStatusBar.setToolTipText(null);
new StatusBarChangeHandler(jcbmiShowHideStatusBar, (String) showHideStatusBarAction.getValue(Action.LONG_DESCRIPTION), this);
jmView.add(jcbmiShowHideStatusBar);
jmView.addSeparator();
jmTabStyle = new JMenu(res.getString("KseFrame.jmTabStyle.text"));
jmTabStyle.setIcon(new ImageIcon(Toolkit.getDefaultToolkit().createImage(getClass().getResource("images/menu/tabstyle.png"))));
PlatformUtil.setMnemonic(jmTabStyle, res.getString("KseFrame.jmTabStyle.mnemonic").charAt(0));
jmView.add(jmTabStyle);
jrbmiTabStyleWrap = new JRadioButtonMenuItem(tabStyleWrapAction);
PlatformUtil.setMnemonic(jrbmiTabStyleWrap, res.getString("KseFrame.jrbmiTabStyleWrap.mnemonic").charAt(0));
jrbmiTabStyleWrap.setToolTipText(null);
new StatusBarChangeHandler(jrbmiTabStyleWrap, (String) tabStyleWrapAction.getValue(Action.LONG_DESCRIPTION), this);
jmTabStyle.add(jrbmiTabStyleWrap);
jrbmiTabStyleScroll = new JRadioButtonMenuItem(tabStyleScrollAction);
PlatformUtil.setMnemonic(jrbmiTabStyleScroll, res.getString("KseFrame.jrbmiTabStyleScroll.mnemonic").charAt(0));
jrbmiTabStyleScroll.setToolTipText(null);
new StatusBarChangeHandler(jrbmiTabStyleScroll, (String) tabStyleScrollAction.getValue(Action.LONG_DESCRIPTION), this);
jmTabStyle.add(jrbmiTabStyleScroll);
ButtonGroup bgTabStyles = new ButtonGroup();
bgTabStyles.add(jrbmiTabStyleWrap);
bgTabStyles.add(jrbmiTabStyleScroll);
int tabLayout = applicationSettings.getTabLayout();
if (tabLayout == JTabbedPane.WRAP_TAB_LAYOUT) {
jrbmiTabStyleWrap.setSelected(true);
} else {
jrbmiTabStyleScroll.setSelected(true);
}
jmTools = new JMenu(res.getString("KseFrame.jmTools.text"));
PlatformUtil.setMnemonic(jmTools, res.getString("KseFrame.jmTools.mnemonic").charAt(0));
jmiGenerateKeyPair = new JMenuItem(generateKeyPairAction);
PlatformUtil.setMnemonic(jmiGenerateKeyPair, res.getString("KseFrame.jmiGenerateKeyPair.mnemonic").charAt(0));
jmiGenerateKeyPair.setToolTipText(null);
new StatusBarChangeHandler(jmiGenerateKeyPair, (String) generateKeyPairAction.getValue(Action.LONG_DESCRIPTION), this);
jmTools.add(jmiGenerateKeyPair);
jmiGenerateSecretKey = new JMenuItem(generateSecretKeyAction);
PlatformUtil.setMnemonic(jmiGenerateSecretKey, res.getString("KseFrame.jmiGenerateSecretKey.mnemonic").charAt(0));
jmiGenerateSecretKey.setToolTipText(null);
new StatusBarChangeHandler(jmiGenerateSecretKey, (String) generateSecretKeyAction.getValue(Action.LONG_DESCRIPTION), this);
jmTools.add(jmiGenerateSecretKey);
jmiGenerateDHParameters = new JMenuItem(generateDHParametersAction);
PlatformUtil.setMnemonic(jmiGenerateDHParameters, res.getString("KseFrame.jmiGenerateDHParameters.mnemonic").charAt(0));
jmiGenerateDHParameters.setToolTipText(null);
new StatusBarChangeHandler(jmiGenerateDHParameters, (String) generateDHParametersAction.getValue(Action.LONG_DESCRIPTION), this);
jmTools.add(jmiGenerateDHParameters);
jmiImportTrustedCertificate = new JMenuItem(importTrustedCertificateAction);
PlatformUtil.setMnemonic(jmiImportTrustedCertificate, res.getString("KseFrame.jmiImportTrustedCertificate.mnemonic").charAt(0));
jmiImportTrustedCertificate.setToolTipText(null);
new StatusBarChangeHandler(jmiImportTrustedCertificate, (String) importTrustedCertificateAction.getValue(Action.LONG_DESCRIPTION), this);
jmTools.add(jmiImportTrustedCertificate);
jmiImportKeyPair = new JMenuItem(importKeyPairAction);
PlatformUtil.setMnemonic(jmiImportKeyPair, res.getString("KseFrame.jmiImportKeyPair.mnemonic").charAt(0));
jmiImportKeyPair.setToolTipText(null);
new StatusBarChangeHandler(jmiImportKeyPair, (String) importKeyPairAction.getValue(Action.LONG_DESCRIPTION), this);
jmTools.add(jmiImportKeyPair);
jmTools.addSeparator();
jmiSetPassword = new JMenuItem(setPasswordAction);
PlatformUtil.setMnemonic(jmiSetPassword, res.getString("KseFrame.jmiSetPassword.mnemonic").charAt(0));
jmiSetPassword.setToolTipText(null);
new StatusBarChangeHandler(jmiSetPassword, (String) setPasswordAction.getValue(Action.LONG_DESCRIPTION), this);
jmTools.add(jmiSetPassword);
jmChangeType = new JMenu(res.getString("KseFrame.jmChangeType.text"));
jmChangeType.setIcon(new ImageIcon(Toolkit.getDefaultToolkit().createImage(getClass().getResource("images/menu/keystoretype.png"))));
PlatformUtil.setMnemonic(jmChangeType, res.getString("KseFrame.jmChangeType.mnemonic").charAt(0));
jmChangeType.setEnabled(false);
jmTools.add(jmChangeType);
jrbmiChangeTypePkcs12 = new JRadioButtonMenuItem(changeTypePkcs12Action);
PlatformUtil.setMnemonic(jrbmiChangeTypePkcs12, res.getString("KseFrame.jrbmiChangeTypePkcs12.mnemonic").charAt(0));
jrbmiChangeTypePkcs12.setToolTipText(null);
new StatusBarChangeHandler(jrbmiChangeTypePkcs12, (String) changeTypePkcs12Action.getValue(Action.LONG_DESCRIPTION), this);
jmChangeType.add(jrbmiChangeTypePkcs12);
jrbmiChangeTypeJceks = new JRadioButtonMenuItem(changeTypeJceksAction);
PlatformUtil.setMnemonic(jrbmiChangeTypeJceks, res.getString("KseFrame.jrbmiChangeTypeJceks.mnemonic").charAt(0));
jrbmiChangeTypeJceks.setToolTipText(null);
new StatusBarChangeHandler(jrbmiChangeTypeJceks, (String) changeTypeJceksAction.getValue(Action.LONG_DESCRIPTION), this);
jmChangeType.add(jrbmiChangeTypeJceks);
jrbmiChangeTypeJks = new JRadioButtonMenuItem(changeTypeJksAction);
PlatformUtil.setMnemonic(jrbmiChangeTypeJks, res.getString("KseFrame.jrbmiChangeTypeJks.mnemonic").charAt(0));
jrbmiChangeTypeJks.setToolTipText(null);
new StatusBarChangeHandler(jrbmiChangeTypeJks, (String) changeTypeJksAction.getValue(Action.LONG_DESCRIPTION), this);
jmChangeType.add(jrbmiChangeTypeJks);
jrbmiChangeTypeBks = new JRadioButtonMenuItem(changeTypeBksAction);
PlatformUtil.setMnemonic(jrbmiChangeTypeBks, res.getString("KseFrame.jrbmiChangeTypeBks.mnemonic").charAt(0));
jrbmiChangeTypeBks.setToolTipText(null);
new StatusBarChangeHandler(jrbmiChangeTypeBks, (String) changeTypeBksAction.getValue(Action.LONG_DESCRIPTION), this);
jmChangeType.add(jrbmiChangeTypeBks);
jrbmiChangeTypeUber = new JRadioButtonMenuItem(changeTypeUberAction);
PlatformUtil.setMnemonic(jrbmiChangeTypeUber, res.getString("KseFrame.jrbmiChangeTypeUber.mnemonic").charAt(0));
jrbmiChangeTypeUber.setToolTipText(null);
new StatusBarChangeHandler(jrbmiChangeTypeUber, (String) changeTypeUberAction.getValue(Action.LONG_DESCRIPTION), this);
jmChangeType.add(jrbmiChangeTypeUber);
jrbmiChangeTypeBcfks = new JRadioButtonMenuItem(changeTypeBcfksAction);
PlatformUtil.setMnemonic(jrbmiChangeTypeBcfks, res.getString("KseFrame.jrbmiChangeTypeBcfks.mnemonic").charAt(0));
jrbmiChangeTypeBcfks.setToolTipText(null);
new StatusBarChangeHandler(jrbmiChangeTypeBcfks, (String) changeTypeBcfksAction.getValue(Action.LONG_DESCRIPTION), this);
jmChangeType.add(jrbmiChangeTypeBcfks);
ButtonGroup changeTypeGroup = new ButtonGroup();
changeTypeGroup.add(jrbmiChangeTypeJks);
changeTypeGroup.add(jrbmiChangeTypeJceks);
changeTypeGroup.add(jrbmiChangeTypePkcs12);
changeTypeGroup.add(jrbmiChangeTypeBks);
changeTypeGroup.add(jrbmiChangeTypeBcfks);
changeTypeGroup.add(jrbmiChangeTypeUber);
jmiProperties = new JMenuItem(propertiesAction);
PlatformUtil.setMnemonic(jmiProperties, res.getString("KseFrame.jmiProperties.mnemonic").charAt(0));
jmiProperties.setToolTipText(null);
new StatusBarChangeHandler(jmiProperties, (String) propertiesAction.getValue(Action.LONG_DESCRIPTION), this);
jmTools.add(jmiProperties);
if (!OperatingSystem.isMacOs()) {
jmTools.addSeparator();
jmiPreferences = new JMenuItem(preferencesAction);
PlatformUtil.setMnemonic(jmiPreferences, res.getString("KseFrame.jmiPreferences.mnemonic").charAt(0));
jmiPreferences.setToolTipText(null);
new StatusBarChangeHandler(jmiPreferences, (String) preferencesAction.getValue(Action.LONG_DESCRIPTION), this);
jmTools.add(jmiPreferences);
}
jmExamine = new JMenu(res.getString("KseFrame.jmExamine.text"));
PlatformUtil.setMnemonic(jmExamine, res.getString("KseFrame.jmExamine.mnemonic").charAt(0));
jmiExamineFile = new JMenuItem(examineFileAction);
PlatformUtil.setMnemonic(jmiExamineFile, res.getString("KseFrame.jmiExamineFile.mnemonic").charAt(0));
jmiExamineFile.setToolTipText(null);
new StatusBarChangeHandler(jmiExamineFile, (String) examineFileAction.getValue(Action.LONG_DESCRIPTION), this);
jmExamine.add(jmiExamineFile);
jmiExamineClipboard = new JMenuItem(examineClipboardAction);
PlatformUtil.setMnemonic(jmiExamineClipboard, res.getString("KseFrame.jmiExamineClipboard.mnemonic").charAt(0));
jmiExamineClipboard.setToolTipText(null);
new StatusBarChangeHandler(jmiExamineClipboard, (String) examineClipboardAction.getValue(Action.LONG_DESCRIPTION), this);
jmExamine.add(jmiExamineClipboard);
jmiExamineSsl = new JMenuItem(examineSslAction);
PlatformUtil.setMnemonic(jmiExamineSsl, res.getString("KseFrame.jmiExamineSsl.mnemonic").charAt(0));
jmiExamineSsl.setToolTipText(null);
new StatusBarChangeHandler(jmiExamineSsl, (String) examineSslAction.getValue(Action.LONG_DESCRIPTION), this);
jmExamine.add(jmiExamineSsl);
jmExamine.addSeparator();
jmiDetectFileType = new JMenuItem(detectFileTypeAction);
PlatformUtil.setMnemonic(jmiDetectFileType, res.getString("KseFrame.jmiDetectFileType.mnemonic").charAt(0));
jmiDetectFileType.setToolTipText(null);
new StatusBarChangeHandler(jmiDetectFileType, (String) detectFileTypeAction.getValue(Action.LONG_DESCRIPTION), this);
jmExamine.add(jmiDetectFileType);
jmHelp = new JMenu(res.getString("KseFrame.jmHelp.text"));
PlatformUtil.setMnemonic(jmHelp, res.getString("KseFrame.jmHelp.mnemonic").charAt(0));
jmiHelp = new JMenuItem(helpAction);
PlatformUtil.setMnemonic(jmiHelp, res.getString("KseFrame.jmiHelp.mnemonic").charAt(0));
jmiHelp.setToolTipText(null);
new StatusBarChangeHandler(jmiHelp, (String) helpAction.getValue(Action.LONG_DESCRIPTION), this);
jmHelp.add(jmiHelp);
jmiTipOfTheDay = new JMenuItem(tipOfTheDayAction);
PlatformUtil.setMnemonic(jmiTipOfTheDay, res.getString("KseFrame.jmiTipOfTheDay.mnemonic").charAt(0));
jmiTipOfTheDay.setToolTipText(null);
new StatusBarChangeHandler(jmiTipOfTheDay, (String) tipOfTheDayAction.getValue(Action.LONG_DESCRIPTION), this);
jmHelp.add(jmiTipOfTheDay);
jmHelp.addSeparator();
jmOnlineResources = new JMenu(res.getString("KseFrame.jmOnlineResources.text"));
jmOnlineResources.setIcon(new ImageIcon(Toolkit.getDefaultToolkit().createImage(getClass().getResource("images/menu/online.png"))));
PlatformUtil.setMnemonic(jmOnlineResources, res.getString("KseFrame.jmOnlineResources.mnemonic").charAt(0));
jmHelp.add(jmOnlineResources);
jmiWebsite = new JMenuItem(websiteAction);
PlatformUtil.setMnemonic(jmiWebsite, res.getString("KseFrame.jmiWebsite.mnemonic").charAt(0));
jmiWebsite.setToolTipText(null);
new StatusBarChangeHandler(jmiWebsite, (String) websiteAction.getValue(Action.LONG_DESCRIPTION), this);
jmOnlineResources.add(jmiWebsite);
jmiSourceforge = new JMenuItem(gitHubProjectSiteAction);
PlatformUtil.setMnemonic(jmiSourceforge, res.getString("KseFrame.jmiSourceforge.mnemonic").charAt(0));
jmiSourceforge.setToolTipText(null);
new StatusBarChangeHandler(jmiSourceforge, (String) gitHubProjectSiteAction.getValue(Action.LONG_DESCRIPTION), this);
jmOnlineResources.add(jmiSourceforge);
jmiSfBugs = new JMenuItem(gitHubIssueTrackerAction);
PlatformUtil.setMnemonic(jmiSfBugs, res.getString("KseFrame.jmiSfBugs.mnemonic").charAt(0));
jmiSfBugs.setToolTipText(null);
new StatusBarChangeHandler(jmiSfBugs, (String) gitHubIssueTrackerAction.getValue(Action.LONG_DESCRIPTION), this);
jmOnlineResources.add(jmiSfBugs);
jmiCheckUpdate = new JMenuItem(checkUpdateAction);
PlatformUtil.setMnemonic(jmiCheckUpdate, res.getString("KseFrame.jmiCheckUpdate.mnemonic").charAt(0));
jmiCheckUpdate.setToolTipText(null);
new StatusBarChangeHandler(jmiCheckUpdate, (String) checkUpdateAction.getValue(Action.LONG_DESCRIPTION), this);
// no update checks if KSE was packaged as rpm
if (!Boolean.getBoolean(KSE_UPDATE_CHECK_DISABLED)) {
jmOnlineResources.add(jmiCheckUpdate);
}
jmiSecurityProviders = new JMenuItem(securityProvidersAction);
PlatformUtil.setMnemonic(jmiSecurityProviders, res.getString("KseFrame.jmiSecurityProviders.mnemonic").charAt(0));
jmiSecurityProviders.setToolTipText(null);
new StatusBarChangeHandler(jmiSecurityProviders, (String) securityProvidersAction.getValue(Action.LONG_DESCRIPTION), this);
jmHelp.add(jmiSecurityProviders);
jmiCryptographyStrength = new JMenuItem(cryptographyStrengthAction);
PlatformUtil.setMnemonic(jmiCryptographyStrength, res.getString("KseFrame.jmiCryptographyStrength.mnemonic").charAt(0));
jmiCryptographyStrength.setToolTipText(null);
new StatusBarChangeHandler(jmiCryptographyStrength, (String) cryptographyStrengthAction.getValue(Action.LONG_DESCRIPTION), this);
jmHelp.add(jmiCryptographyStrength);
jmiJars = new JMenuItem(jarsAction);
PlatformUtil.setMnemonic(jmiJars, res.getString("KseFrame.jmiJars.mnemonic").charAt(0));
jmiJars.setToolTipText(null);
new StatusBarChangeHandler(jmiJars, (String) jarsAction.getValue(Action.LONG_DESCRIPTION), this);
jmHelp.add(jmiJars);
jmiSystemInformation = new JMenuItem(systemInformationAction);
PlatformUtil.setMnemonic(jmiSystemInformation, res.getString("KseFrame.jmiSystemInformation.mnemonic").charAt(0));
jmiSystemInformation.setToolTipText(null);
new StatusBarChangeHandler(jmiSystemInformation, (String) systemInformationAction.getValue(Action.LONG_DESCRIPTION), this);
jmHelp.add(jmiSystemInformation);
if (!OperatingSystem.isMacOs()) {
jmHelp.addSeparator();
jmiAbout = new JMenuItem(aboutAction);
PlatformUtil.setMnemonic(jmiAbout, res.getString("KseFrame.jmiAbout.mnemonic").charAt(0));
jmiAbout.setToolTipText(null);
new StatusBarChangeHandler(jmiAbout, (String) aboutAction.getValue(Action.LONG_DESCRIPTION), this);
jmHelp.add(jmiAbout);
}
jmbMenuBar.add(jmFile);
jmbMenuBar.add(jmEdit);
jmbMenuBar.add(jmView);
jmbMenuBar.add(jmTools);
jmbMenuBar.add(jmExamine);
jmbMenuBar.add(jmHelp);
frame.setJMenuBar(jmbMenuBar);
}
use of javax.swing.JRadioButtonMenuItem in project triplea by triplea-game.
the class JMenuItemBuilder method buildRadio.
/**
* Constructs a Swing JRadioButtonMenuItem using current builder values.
*/
public JRadioButtonMenuItem buildRadio(final ButtonGroup group) {
final JRadioButtonMenuItem menuItem = new JRadioButtonMenuItem(title, selected);
buildImpl(menuItem);
group.add(menuItem);
return menuItem;
}
use of javax.swing.JRadioButtonMenuItem in project triplea by triplea-game.
the class ViewMenu method addUnitSizeMenu.
private void addUnitSizeMenu() {
final NumberFormat decimalFormat = new DecimalFormat("00.##");
// This is the action listener used
class UnitSizeAction extends AbstractAction {
private static final long serialVersionUID = -6280511505686687867L;
private final double scaleFactor;
private UnitSizeAction(final double scaleFactor) {
super(decimalFormat.format(scaleFactor * 100) + "%");
this.scaleFactor = scaleFactor;
}
@Override
public void actionPerformed(final ActionEvent e) {
uiContext.setUnitScaleFactor(scaleFactor);
frame.getMapPanel().resetMap();
}
}
final JMenu unitSizeMenu = new JMenu();
unitSizeMenu.setMnemonic(KeyEvent.VK_S);
unitSizeMenu.setText("Unit Size");
final ButtonGroup unitSizeGroup = new ButtonGroup();
final JRadioButtonMenuItem radioItem125 = new JRadioButtonMenuItem(new UnitSizeAction(1.25));
final JRadioButtonMenuItem radioItem100 = new JRadioButtonMenuItem(new UnitSizeAction(1.0));
radioItem100.setMnemonic(KeyEvent.VK_1);
final JRadioButtonMenuItem radioItem87 = new JRadioButtonMenuItem(new UnitSizeAction(0.875));
final JRadioButtonMenuItem radioItem83 = new JRadioButtonMenuItem(new UnitSizeAction(0.8333));
radioItem83.setMnemonic(KeyEvent.VK_8);
final JRadioButtonMenuItem radioItem75 = new JRadioButtonMenuItem(new UnitSizeAction(0.75));
radioItem75.setMnemonic(KeyEvent.VK_7);
final JRadioButtonMenuItem radioItem66 = new JRadioButtonMenuItem(new UnitSizeAction(0.6666));
radioItem66.setMnemonic(KeyEvent.VK_6);
final JRadioButtonMenuItem radioItem56 = new JRadioButtonMenuItem(new UnitSizeAction(0.5625));
final JRadioButtonMenuItem radioItem50 = new JRadioButtonMenuItem(new UnitSizeAction(0.5));
radioItem50.setMnemonic(KeyEvent.VK_5);
unitSizeGroup.add(radioItem125);
unitSizeGroup.add(radioItem100);
unitSizeGroup.add(radioItem87);
unitSizeGroup.add(radioItem83);
unitSizeGroup.add(radioItem75);
unitSizeGroup.add(radioItem66);
unitSizeGroup.add(radioItem56);
unitSizeGroup.add(radioItem50);
radioItem100.setSelected(true);
// select the closest to to the default size
final Enumeration<AbstractButton> enum1 = unitSizeGroup.getElements();
boolean matchFound = false;
while (enum1.hasMoreElements()) {
final JRadioButtonMenuItem menuItem = (JRadioButtonMenuItem) enum1.nextElement();
final UnitSizeAction action = (UnitSizeAction) menuItem.getAction();
if (Math.abs(action.scaleFactor - uiContext.getUnitImageFactory().getScaleFactor()) < 0.01) {
menuItem.setSelected(true);
matchFound = true;
break;
}
}
if (!matchFound) {
log.error("default unit size does not match any menu item");
}
unitSizeMenu.add(radioItem125);
unitSizeMenu.add(radioItem100);
unitSizeMenu.add(radioItem87);
unitSizeMenu.add(radioItem83);
unitSizeMenu.add(radioItem75);
unitSizeMenu.add(radioItem66);
unitSizeMenu.add(radioItem56);
unitSizeMenu.add(radioItem50);
add(unitSizeMenu);
}
use of javax.swing.JRadioButtonMenuItem in project rom-manager by Jakz.
the class ViewMenu method rebuild.
void rebuild(GameSet set, GameListData.Mode mode, boolean isTreeMode) {
if (set != null) {
// TODO: mind that there's no check for overlap
final int firstStroke = KeyEvent.VK_F1;
final GameStatus[] statuses = GameStatus.values();
for (int i = 0; i < filterByStatus.length; ++i) {
filterByStatus[i] = new JCheckBoxMenuItem("Show " + statuses[i].name.toLowerCase(), true);
filterByStatus[i].setAccelerator(KeyStroke.getKeyStroke(firstStroke + i, 0));
filterByStatus[i].addActionListener(listener);
add(filterByStatus[i]);
}
if (set.hasFeature(Feature.CLONES)) {
JMenu modeMenu = new JMenu("Mode");
viewModes = new JRadioButtonMenuItem[3];
viewModes[0] = new JRadioButtonMenuItem("Games");
viewModes[1] = new JRadioButtonMenuItem("Clones");
viewModes[2] = new JRadioButtonMenuItem("Clones Tree");
viewModesRadioGroup = new ButtonGroup();
viewModesRadioGroup.add(viewModes[0]);
viewModesRadioGroup.add(viewModes[1]);
viewModesRadioGroup.add(viewModes[2]);
if (isTreeMode)
viewModes[2].setSelected(true);
else if (mode == GameListData.Mode.CLONES)
viewModes[1].setSelected(true);
else
viewModes[0].setSelected(true);
;
modeMenu.add(viewModes[0]);
modeMenu.add(viewModes[1]);
modeMenu.add(viewModes[2]);
ActionListener switchModeListener = e -> {
GameListData.Mode m = e.getSource() == viewModes[0] ? GameListData.Mode.GAMES : GameListData.Mode.CLONES;
boolean treeMode = e.getSource() == viewModes[2];
mediator.switchGameListMode(m, treeMode);
};
viewModes[0].addActionListener(switchModeListener);
viewModes[1].addActionListener(switchModeListener);
viewModes[2].addActionListener(switchModeListener);
add(modeMenu);
}
addSeparator();
sortCriteriaRadioGroup = new ButtonGroup();
sortCriteria = new JRadioButtonMenuItem[sortAttributes.length + 1];
JMenu sortMenu = new JMenu(Text.MENU_VIEW_SORT_BY.text());
sortCriteria[0] = new JRadioButtonMenuItem("None");
for (int i = 0; i < sortAttributes.length; ++i) sortCriteria[i + 1] = new JRadioButtonMenuItem(sortAttributes[i].getCaption());
for (JRadioButtonMenuItem menuItem : sortCriteria) {
menuItem.addActionListener(listener);
sortCriteriaRadioGroup.add(menuItem);
sortMenu.add(menuItem);
}
sortCriteria[0].setSelected(true);
sortCriteria[3].setEnabled(set.doesSupportAttribute(GameAttribute.NUMBER));
reverseSortOrder = new JCheckBoxMenuItem(Text.MENU_VIEW_REVERSE_ORDER.text());
reverseSortOrder.addActionListener(listener);
add(sortMenu);
add(reverseSortOrder);
}
}
use of javax.swing.JRadioButtonMenuItem in project pmd by pmd.
the class Designer method createMenuBar.
private JMenuBar createMenuBar() {
JMenuBar menuBar = new JMenuBar();
JMenu menu = new JMenu("Language");
ButtonGroup group = new ButtonGroup();
LanguageVersion[] languageVersions = getSupportedLanguageVersions();
for (int i = 0; i < languageVersions.length; i++) {
LanguageVersion languageVersion = languageVersions[i];
JRadioButtonMenuItem button = new JRadioButtonMenuItem(languageVersion.getShortName());
languageVersionMenuItems[i] = button;
group.add(button);
menu.add(button);
}
languageVersionMenuItems[getDefaultLanguageVersionSelectionIndex()].setSelected(true);
menuBar.add(menu);
JMenu actionsMenu = new JMenu("Actions");
JMenuItem copyXMLItem = new JMenuItem("Copy xml to clipboard");
copyXMLItem.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
copyXmlToClipboard();
}
});
actionsMenu.add(copyXMLItem);
JMenuItem createRuleXMLItem = new JMenuItem("Create rule XML");
createRuleXMLItem.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
createRuleXML();
}
});
actionsMenu.add(createRuleXMLItem);
menuBar.add(actionsMenu);
return menuBar;
}
Aggregations