List of usage examples for com.jgoodies.looks Options HEADER_STYLE_KEY
String HEADER_STYLE_KEY
To view the source code for com.jgoodies.looks Options HEADER_STYLE_KEY.
Click Source Link
From source file:net.sf.jabref.gui.JabRefFrame.java
License:Open Source License
private void createToolBar() { tlb.putClientProperty(Options.HEADER_STYLE_KEY, HeaderStyle.BOTH); tlb.setBorder(null);//w ww.ja v a 2 s .c o m tlb.setRollover(true); tlb.setFloatable(false); if (Globals.prefs.getBoolean(JabRefPreferences.BIBLATEX_DEFAULT_MODE)) { tlb.addAction(newBiblatexDatabaseAction); } else { tlb.addAction(newBibtexDatabaseAction); } tlb.addAction(getOpenDatabaseAction()); tlb.addAction(save); tlb.addAction(saveAll); tlb.addSeparator(); tlb.addAction(cut); tlb.addAction(copy); tlb.addAction(paste); tlb.addAction(undo); tlb.addAction(redo); tlb.addSeparator(); tlb.addAction(getBackAction()); tlb.addAction(getForwardAction()); tlb.addSeparator(); tlb.addAction(newEntryAction); tlb.addAction(editEntry); tlb.addAction(editStrings); tlb.addAction(deleteEntry); tlb.addSeparator(); tlb.addAction(makeKeyAction); tlb.addAction(cleanupEntries); tlb.addAction(mergeEntries); tlb.addSeparator(); tlb.addAction(mark); tlb.addAction(unmark); tlb.addSeparator(); if (Globals.prefs.getBoolean(SpecialFieldsUtils.PREF_SPECIALFIELDSENABLED)) { if (Globals.prefs.getBoolean(SpecialFieldsUtils.PREF_SHOWCOLUMN_RANKING)) { JButton button = net.sf.jabref.specialfields.SpecialFieldDropDown .generateSpecialFieldButtonWithDropDown(Rank.getInstance(), this); tlb.add(button); specialFieldButtons.add(button); } if (Globals.prefs.getBoolean(SpecialFieldsUtils.PREF_SHOWCOLUMN_RELEVANCE)) { tlb.addAction(toggleRelevance); } if (Globals.prefs.getBoolean(SpecialFieldsUtils.PREF_SHOWCOLUMN_QUALITY)) { tlb.addAction(toggleQualityAssured); } if (Globals.prefs.getBoolean(SpecialFieldsUtils.PREF_SHOWCOLUMN_PRIORITY)) { JButton button = net.sf.jabref.specialfields.SpecialFieldDropDown .generateSpecialFieldButtonWithDropDown(Priority.getInstance(), this); tlb.add(button); specialFieldButtons.add(button); } if (Globals.prefs.getBoolean(SpecialFieldsUtils.PREF_SHOWCOLUMN_PRINTED)) { tlb.addAction(togglePrinted); } if (Globals.prefs.getBoolean(SpecialFieldsUtils.PREF_SHOWCOLUMN_READ)) { JButton button = net.sf.jabref.specialfields.SpecialFieldDropDown .generateSpecialFieldButtonWithDropDown(ReadStatus.getInstance(), this); tlb.add(button); specialFieldButtons.add(button); } tlb.addSeparator(); } fetcherToggle = new JToggleButton(generalFetcher.getAction()); tlb.addJToogleButton(fetcherToggle); previewToggle = new JToggleButton(togglePreview); tlb.addJToogleButton(previewToggle); groupToggle = new JToggleButton(toggleGroups); tlb.addJToogleButton(groupToggle); tlb.addSeparator(); tlb.add(pushExternalButton.getComponent()); tlb.addSeparator(); tlb.add(donationAction); }
From source file:net.sf.jabref.JabRefFrame.java
License:Open Source License
private void createToolBar() { tlb.putClientProperty(Options.HEADER_STYLE_KEY, HeaderStyle.BOTH); tlb.setBorder(null);//from w w w .j av a 2 s . co m tlb.setRollover(true); //tlb.setBorderPainted(true); //tlb.setBackground(GUIGlobals.lightGray); //tlb.setForeground(GUIGlobals.lightGray); tlb.setFloatable(false); tlb.addAction(newDatabaseAction); tlb.addAction(open); tlb.addAction(save); tlb.addAction(saveAll); //tlb.addAction(dbConnect); //tlb.addAction(dbExport); tlb.addSeparator(); tlb.addAction(cut); tlb.addAction(copy); tlb.addAction(paste); tlb.addAction(undo); tlb.addAction(redo); tlb.addSeparator(); tlb.addAction(back); tlb.addAction(forward); tlb.addSeparator(); tlb.addAction(newEntryAction); tlb.addAction(editEntry); tlb.addAction(editPreamble); tlb.addAction(editStrings); tlb.addAction(makeKeyAction); tlb.addAction(Cleanup); tlb.addAction(mergeEntries); tlb.addSeparator(); tlb.addAction(mark); tlb.addAction(unmark); tlb.addSeparator(); if (Globals.prefs.getBoolean(SpecialFieldsUtils.PREF_SPECIALFIELDSENABLED)) { if (Globals.prefs.getBoolean(SpecialFieldsUtils.PREF_SHOWCOLUMN_RANKING)) { tlb.add(net.sf.jabref.specialfields.SpecialFieldDropDown .generateSpecialFieldButtonWithDropDown(Rank.getInstance(), this)); } if (Globals.prefs.getBoolean(SpecialFieldsUtils.PREF_SHOWCOLUMN_RELEVANCE)) { tlb.addAction(toggleRelevance); } if (Globals.prefs.getBoolean(SpecialFieldsUtils.PREF_SHOWCOLUMN_QUALITY)) { tlb.addAction(toggleQualityAssured); } if (Globals.prefs.getBoolean(SpecialFieldsUtils.PREF_SHOWCOLUMN_PRIORITY)) { tlb.add(net.sf.jabref.specialfields.SpecialFieldDropDown .generateSpecialFieldButtonWithDropDown(Priority.getInstance(), this)); } if (Globals.prefs.getBoolean(SpecialFieldsUtils.PREF_SHOWCOLUMN_PRINTED)) { tlb.addAction(togglePrinted); } if (Globals.prefs.getBoolean(SpecialFieldsUtils.PREF_SHOWCOLUMN_READ)) { tlb.add(net.sf.jabref.specialfields.SpecialFieldDropDown .generateSpecialFieldButtonWithDropDown(ReadStatus.getInstance(), this)); } } tlb.addSeparator(); searchToggle = new JToggleButton(toggleSearch); searchToggle.setText(null); if (!Globals.ON_MAC) { searchToggle.setMargin(marg); } tlb.add(searchToggle); previewToggle = new JToggleButton(togglePreview); previewToggle.setText(null); if (!Globals.ON_MAC) { previewToggle.setMargin(marg); } tlb.add(previewToggle); tlb.addSeparator(); groupToggle = new JToggleButton(toggleGroups); groupToggle.setText(null); if (!Globals.ON_MAC) { groupToggle.setMargin(marg); } tlb.add(groupToggle); highlightAny = new JToggleButton(toggleHighlightAny); highlightAny.setText(null); if (!Globals.ON_MAC) { highlightAny.setMargin(marg); } tlb.add(highlightAny); highlightAll = new JToggleButton(toggleHighlightAll); highlightAll.setText(null); if (!Globals.ON_MAC) { highlightAll.setMargin(marg); } tlb.add(highlightAll); tlb.addSeparator(); // Removing the separate push-to buttons, replacing them by the // multipurpose button: //tlb.addAction(emacsPushAction); //tlb.addAction(lyxPushAction); //tlb.addAction(winEdtPushAction); tlb.add(pushExternalButton.getComponent()); tlb.addAction(openFolder); tlb.addAction(openFile); //tlb.addAction(openPdf); //tlb.addAction(openUrl); //tlb.addSeparator(); //tlb.addAction(showPrefs); tlb.add(Box.createHorizontalGlue()); //tlb.add(new JabRefLabel(GUIGlobals.frameTitle+" "+GUIGlobals.version)); tlb.addAction(closeDatabaseAction); //Insets margin = new Insets(0, 0, 0, 0); //for (int i=0; i<tlb.getComponentCount(); i++) // ((JButton)tlb.getComponentAtIndex(i)).setMargin(margin); }
From source file:net.sf.jabref.specialfields.SpecialFieldDropDown.java
License:Open Source License
public static JButton generateSpecialFieldButtonWithDropDown(SpecialField field, JabRefFrame frame) { Dimension buttonDim = new Dimension(23, 23); JButton button = new JButton(field.getRepresentingIcon()); button.setToolTipText(field.getToolTip()); button.setPreferredSize(buttonDim);//from w w w . j a va 2 s . c o m if (!Globals.ON_MAC) { button.setMargin(new Insets(1, 0, 2, 0)); } button.setBorder(null); button.setBorderPainted(false); button.setRolloverEnabled(true); button.setOpaque(false); button.setBounds(0, 0, buttonDim.width, buttonDim.height); button.setSize(buttonDim); button.setMinimumSize(buttonDim); button.setMaximumSize(buttonDim); button.putClientProperty(Options.HEADER_STYLE_KEY, HeaderStyle.BOTH); button.addActionListener(new MenuButtonActionListener(field, frame, button, buttonDim)); return button; }
From source file:net.sf.keystore_explorer.gui.KseFrame.java
License:Open Source License
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);//from ww w . j av a 2 s .com 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(res.getString("KseFrame.jmOpenSpecial.image"))))); 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(res.getString("KseFrame.jmrfRecentFiles.image"))))); PlatformUtil.setMnemonic(jmrfRecentFiles, res.getString("KseFrame.jmrfRecentFiles.mnemonic").charAt(0)); jmrfRecentFiles.putClientProperty(Options.NO_ICONS_KEY, Boolean.TRUE); // For the benefit of the plastic L&F 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); 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(res.getString("KseFrame.jmTabStyle.image"))))); 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); 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(res.getString("KseFrame.jmChangeType.image"))))); PlatformUtil.setMnemonic(jmChangeType, res.getString("KseFrame.jmChangeType.mnemonic").charAt(0)); jmChangeType.setEnabled(false); jmChangeType.putClientProperty(Options.NO_ICONS_KEY, Boolean.TRUE); // For the benefit of the plastic L&F jmTools.add(jmChangeType); 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); jrbmiChangeTypeHTks = new JRadioButtonMenuItem(changeTypeHTksAction); PlatformUtil.setMnemonic(jrbmiChangeTypeHTks, res.getString("KseFrame.jrbmiChangeTypeJks.mnemonic").charAt(0)); jrbmiChangeTypeHTks.setToolTipText(null); new StatusBarChangeHandler(jrbmiChangeTypeHTks, (String) changeTypeHTksAction.getValue(Action.LONG_DESCRIPTION), this); jmChangeType.add(jrbmiChangeTypeHTks); 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); 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); jrbmiChangeTypeBksV1 = new JRadioButtonMenuItem(changeTypeBksV1Action); PlatformUtil.setMnemonic(jrbmiChangeTypeBksV1, res.getString("KseFrame.jrbmiChangeTypeBksV1.mnemonic").charAt(0)); jrbmiChangeTypeBksV1.setToolTipText(null); new StatusBarChangeHandler(jrbmiChangeTypeBksV1, (String) changeTypeBksV1Action.getValue(Action.LONG_DESCRIPTION), this); jmChangeType.add(jrbmiChangeTypeBksV1); 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); ButtonGroup changeTypeGroup = new ButtonGroup(); changeTypeGroup.add(jrbmiChangeTypeJks); changeTypeGroup.add(jrbmiChangeTypeJceks); changeTypeGroup.add(jrbmiChangeTypePkcs12); changeTypeGroup.add(jrbmiChangeTypeBks); changeTypeGroup.add(jrbmiChangeTypeBksV1); 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(res.getString("KseFrame.jmOnlineResources.image"))))); 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); jmbMenuBar.putClientProperty(Options.HEADER_STYLE_KEY, HeaderStyle.BOTH); frame.setJMenuBar(jmbMenuBar); }
From source file:net.sf.keystore_explorer.gui.KseFrame.java
License:Open Source License
private void initToolBar() { jbNew = new JButton(); jbNew.setAction(newAction);//from www. j a va 2 s .co m jbNew.setText(null); PlatformUtil.setMnemonic(jbNew, 0); jbNew.setFocusable(false); jbNew.addMouseListener(new MouseAdapter() { @Override public void mouseEntered(MouseEvent evt) { setStatusBarText((String) newAction.getValue(Action.LONG_DESCRIPTION)); } @Override public void mouseExited(MouseEvent evt) { setDefaultStatusBarText(); } }); jbOpen = new JButton(); jbOpen.setAction(openAction); jbOpen.setText(null); PlatformUtil.setMnemonic(jbOpen, 0); jbOpen.setFocusable(false); jbOpen.addMouseListener(new MouseAdapter() { @Override public void mouseEntered(MouseEvent evt) { setStatusBarText((String) openAction.getValue(Action.LONG_DESCRIPTION)); } @Override public void mouseExited(MouseEvent evt) { setDefaultStatusBarText(); } }); jbSave = new JButton(); jbSave.setAction(saveAction); jbSave.setText(null); PlatformUtil.setMnemonic(jbSave, 0); jbSave.setFocusable(false); jbSave.addMouseListener(new MouseAdapter() { @Override public void mouseEntered(MouseEvent evt) { setStatusBarText((String) saveAction.getValue(Action.LONG_DESCRIPTION)); } @Override public void mouseExited(MouseEvent evt) { setDefaultStatusBarText(); } }); jbUndo = new JButton(); jbUndo.setAction(undoAction); jbUndo.setText(null); PlatformUtil.setMnemonic(jbUndo, 0); jbUndo.setHideActionText(true); // Ensure text is not displayed when // changed dynamically // later on action jbUndo.setFocusable(false); jbUndo.addMouseListener(new MouseAdapter() { @Override public void mouseEntered(MouseEvent evt) { setStatusBarText((String) undoAction.getValue(Action.LONG_DESCRIPTION)); } @Override public void mouseExited(MouseEvent evt) { setDefaultStatusBarText(); } }); jbRedo = new JButton(); jbRedo.setAction(redoAction); jbRedo.setText(null); PlatformUtil.setMnemonic(jbRedo, 0); jbRedo.setHideActionText(true); // Ensure text is not displayed when // changed dynamically // later on action jbRedo.setFocusable(false); jbRedo.addMouseListener(new MouseAdapter() { @Override public void mouseEntered(MouseEvent evt) { setStatusBarText((String) redoAction.getValue(Action.LONG_DESCRIPTION)); } @Override public void mouseExited(MouseEvent evt) { setDefaultStatusBarText(); } }); jbCut = new JButton(); jbCut.setAction(cutAction); jbCut.setText(null); PlatformUtil.setMnemonic(jbCut, 0); jbCut.setFocusable(false); jbCut.addMouseListener(new MouseAdapter() { @Override public void mouseEntered(MouseEvent evt) { setStatusBarText((String) cutAction.getValue(Action.LONG_DESCRIPTION)); } @Override public void mouseExited(MouseEvent evt) { setDefaultStatusBarText(); } }); jbCopy = new JButton(); jbCopy.setAction(copyAction); jbCopy.setText(null); PlatformUtil.setMnemonic(jbCopy, 0); jbCopy.setFocusable(false); jbCopy.addMouseListener(new MouseAdapter() { @Override public void mouseEntered(MouseEvent evt) { setStatusBarText((String) copyAction.getValue(Action.LONG_DESCRIPTION)); } @Override public void mouseExited(MouseEvent evt) { setDefaultStatusBarText(); } }); jbPaste = new JButton(); jbPaste.setAction(pasteAction); jbPaste.setText(null); PlatformUtil.setMnemonic(jbPaste, 0); jbPaste.setFocusable(false); jbPaste.addMouseListener(new MouseAdapter() { @Override public void mouseEntered(MouseEvent evt) { setStatusBarText((String) pasteAction.getValue(Action.LONG_DESCRIPTION)); } @Override public void mouseExited(MouseEvent evt) { setDefaultStatusBarText(); } }); jbGenerateKeyPair = new JButton(); jbGenerateKeyPair.setAction(generateKeyPairAction); jbGenerateKeyPair.setText(null); PlatformUtil.setMnemonic(jbGenerateKeyPair, 0); jbGenerateKeyPair.setFocusable(false); jbGenerateKeyPair.addMouseListener(new MouseAdapter() { @Override public void mouseEntered(MouseEvent evt) { setStatusBarText((String) generateKeyPairAction.getValue(Action.LONG_DESCRIPTION)); } @Override public void mouseExited(MouseEvent evt) { setDefaultStatusBarText(); } }); jbGenerateSecretKey = new JButton(); jbGenerateSecretKey.setAction(generateSecretKeyAction); jbGenerateSecretKey.setText(null); PlatformUtil.setMnemonic(jbGenerateSecretKey, 0); jbGenerateSecretKey.setFocusable(false); jbGenerateSecretKey.addMouseListener(new MouseAdapter() { @Override public void mouseEntered(MouseEvent evt) { setStatusBarText((String) generateSecretKeyAction.getValue(Action.LONG_DESCRIPTION)); } @Override public void mouseExited(MouseEvent evt) { setDefaultStatusBarText(); } }); jbImportTrustedCertificate = new JButton(); jbImportTrustedCertificate.setAction(importTrustedCertificateAction); jbImportTrustedCertificate.setText(null); PlatformUtil.setMnemonic(jbImportTrustedCertificate, 0); jbImportTrustedCertificate.setFocusable(false); jbImportTrustedCertificate.addMouseListener(new MouseAdapter() { @Override public void mouseEntered(MouseEvent evt) { setStatusBarText((String) importTrustedCertificateAction.getValue(Action.LONG_DESCRIPTION)); } @Override public void mouseExited(MouseEvent evt) { setDefaultStatusBarText(); } }); jbImportKeyPair = new JButton(); jbImportKeyPair.setAction(importKeyPairAction); jbImportKeyPair.setText(null); PlatformUtil.setMnemonic(jbImportKeyPair, 0); jbImportKeyPair.setFocusable(false); jbImportKeyPair.addMouseListener(new MouseAdapter() { @Override public void mouseEntered(MouseEvent evt) { setStatusBarText((String) importKeyPairAction.getValue(Action.LONG_DESCRIPTION)); } @Override public void mouseExited(MouseEvent evt) { setDefaultStatusBarText(); } }); jbSetPassword = new JButton(); jbSetPassword.setAction(setPasswordAction); jbSetPassword.setText(null); PlatformUtil.setMnemonic(jbSetPassword, 0); jbSetPassword.setFocusable(false); jbSetPassword.addMouseListener(new MouseAdapter() { @Override public void mouseEntered(MouseEvent evt) { setStatusBarText((String) setPasswordAction.getValue(Action.LONG_DESCRIPTION)); } @Override public void mouseExited(MouseEvent evt) { setDefaultStatusBarText(); } }); jbProperties = new JButton(); jbProperties.setAction(propertiesAction); jbProperties.setText(null); PlatformUtil.setMnemonic(jbProperties, 0); jbProperties.setFocusable(false); jbProperties.addMouseListener(new MouseAdapter() { @Override public void mouseEntered(MouseEvent evt) { setStatusBarText((String) propertiesAction.getValue(Action.LONG_DESCRIPTION)); } @Override public void mouseExited(MouseEvent evt) { setDefaultStatusBarText(); } }); jbExamineFile = new JButton(); jbExamineFile.setAction(examineFileAction); jbExamineFile.setText(null); PlatformUtil.setMnemonic(jbExamineFile, 0); jbExamineFile.setFocusable(false); jbExamineFile.addMouseListener(new MouseAdapter() { @Override public void mouseEntered(MouseEvent evt) { setStatusBarText((String) examineFileAction.getValue(Action.LONG_DESCRIPTION)); } @Override public void mouseExited(MouseEvent evt) { setDefaultStatusBarText(); } }); jbExamineClipboard = new JButton(); jbExamineClipboard.setAction(examineClipboardAction); jbExamineClipboard.setText(null); PlatformUtil.setMnemonic(jbExamineClipboard, 0); jbExamineClipboard.setFocusable(false); jbExamineClipboard.addMouseListener(new MouseAdapter() { @Override public void mouseEntered(MouseEvent evt) { setStatusBarText((String) examineClipboardAction.getValue(Action.LONG_DESCRIPTION)); } @Override public void mouseExited(MouseEvent evt) { setDefaultStatusBarText(); } }); jbExamineSsl = new JButton(); jbExamineSsl.setAction(examineSslAction); jbExamineSsl.setText(null); PlatformUtil.setMnemonic(jbExamineSsl, 0); jbExamineSsl.setFocusable(false); jbExamineSsl.addMouseListener(new MouseAdapter() { @Override public void mouseEntered(MouseEvent evt) { setStatusBarText((String) examineSslAction.getValue(Action.LONG_DESCRIPTION)); } @Override public void mouseExited(MouseEvent evt) { setDefaultStatusBarText(); } }); jbHelp = new JButton(); jbHelp.setAction(helpAction); jbHelp.setText(null); PlatformUtil.setMnemonic(jbHelp, 0); jbHelp.setFocusable(false); jbHelp.addMouseListener(new MouseAdapter() { @Override public void mouseEntered(MouseEvent evt) { setStatusBarText((String) helpAction.getValue(Action.LONG_DESCRIPTION)); } @Override public void mouseExited(MouseEvent evt) { setDefaultStatusBarText(); } }); jtbToolBar = new JToolBar(); // If using Windows need a bottom line on the toolbar to seperate it // from the main view if (LnfUtil.usingWindowsLnf() || LnfUtil.usingWindowsClassicLnf()) { jtbToolBar.setBorder(new MatteBorder(0, 0, 1, 0, Color.LIGHT_GRAY)); } jtbToolBar.setFloatable(false); jtbToolBar.setRollover(true); jtbToolBar.setName(KSE.getApplicationName()); jtbToolBar.add(jbNew); jtbToolBar.add(jbOpen); jtbToolBar.add(jbSave); jtbToolBar.addSeparator(); jtbToolBar.add(jbUndo); jtbToolBar.add(jbRedo); jtbToolBar.addSeparator(); jtbToolBar.add(jbCut); jtbToolBar.add(jbCopy); jtbToolBar.add(jbPaste); jtbToolBar.addSeparator(); jtbToolBar.add(jbGenerateKeyPair); jtbToolBar.add(jbGenerateSecretKey); jtbToolBar.add(jbImportTrustedCertificate); jtbToolBar.add(jbImportKeyPair); jtbToolBar.add(jbSetPassword); jtbToolBar.add(jbProperties); jtbToolBar.addSeparator(); jtbToolBar.add(jbExamineFile); jtbToolBar.add(jbExamineClipboard); jtbToolBar.add(jbExamineSsl); jtbToolBar.addSeparator(); jtbToolBar.add(jbHelp); jtbToolBar.putClientProperty(Options.HEADER_STYLE_KEY, HeaderStyle.BOTH); if (applicationSettings.getShowToolBar()) { frame.getContentPane().add(jtbToolBar, BorderLayout.NORTH); } }
From source file:org.deegree.igeo.desktop.AbstractiGeoDesktop.java
License:Open Source License
/** * appends entries into the tool bar//from ww w .j av a2 s.c o m * * @param module * the module the entries belongs to * @param toolBarEntries * the entries to add as new toolBar */ protected void appendToolBar(IModule<Container> module, List<ToolbarEntryType> toolBarEntries) { if (toolBarEntries.size() > 0) { ToolBar toolBar; if (module != null) { toolBar = (ToolBar) module.getToolBarController().getView(); } else { toolBar = (ToolBar) this.toolBarController.getView(); } toolBar.putClientProperty(Options.HEADER_STYLE_KEY, HeaderStyle.BOTH); List<AbstractButton> btList = null; String key = ""; if (module != null) { key = module.getIdentifier().getValue(); if (module instanceof DefaultMapModule<?>) { key = module.getClass().getName(); } } if (module != null && !toolbarButtons.containsKey(key)) { btList = new ArrayList<AbstractButton>(); toolbarButtons.put(key, btList); } else { btList = new ArrayList<AbstractButton>(); } for (ToolbarEntryType entry : toolBarEntries) { toolBar.setFloatable(proj.getView().getToolBar().get(0).isFloatable()); toolBar.setRollover(proj.getView().getToolBar().get(0).isUseRollover()); AbstractButton button = null; if (entry.getEntryType() == null || entry.getEntryType().value().equalsIgnoreCase("ToggleButton")) { // use ToggleButton as default if (entry.getName() != null && entry.getName().length() > 0) { String title = Messages.getMessage(Locale.getDefault(), entry.getName()); button = new JToggleButton(title); } else { button = new JToggleButton(); } } else if (entry.getEntryType().value().equalsIgnoreCase("PushButton")) { if (entry.getName() != null && entry.getName().length() > 0) { String title = Messages.getMessage(Locale.getDefault(), entry.getName()); button = new JButton(title); } else { button = new JButton(); } } else if (entry.getEntryType().value().equalsIgnoreCase("RadioButton")) { if (entry.getName() != null && entry.getName().length() > 0) { String title = Messages.getMessage(Locale.getDefault(), entry.getName()); button = new JRadioButton(title); } else { button = new JRadioButton(); } } else if (entry.getEntryType().value().equalsIgnoreCase("CheckBox")) { if (entry.getName() != null && entry.getName().length() > 0) { String title = Messages.getMessage(Locale.getDefault(), entry.getName()); button = new JCheckBox(title); } else { button = new JCheckBox(); } } else { throw new RuntimeException("not supported toolbar entry type: " + entry.getEntryType()); } // store button assign with an action to avoid initializing it twice btList.add(button); button.setBorder(BorderFactory.createEmptyBorder()); String groupName = entry.getAssignedGroup(); // if group a button is assigned to already exists add button // otherwise create a new group if (groupName != null && groupName.length() > 0) { ButtonGroup assignedGroup = btGroups.get(groupName); if (assignedGroup == null) { assignedGroup = new ButtonGroup(); btGroups.put(groupName, assignedGroup); } assignedGroup.add(button); } // register component for a module and action. This will be used // to synchronize state of different components responsible for // the same action if (module == null) { // must be assigned to application itself registerAction(Util.convertIdentifier(proj.getIdentifier()), entry.getAssignedAction(), button); // if assigned module != null it tool bar item will be assigned to main // application button.addActionListener(this); } else { registerAction(module.getIdentifier(), entry.getAssignedAction(), button); button.addActionListener(module); } button.setName(entry.getAssignedAction()); button.setVisible(true); if (entry.getTooltip() != null) { button.setToolTipText(Messages.getMessage(getLocale(), entry.getTooltip())); } addIcon(entry.getIcon(), button, 25); toolBar.add(button); } toolBar.setMargin(new Insets(3, 3, 3, 3)); if (proj.getView().getToolBar().get(0).isVertical()) { toolBar.setOrientation(JToolBar.VERTICAL); } this.toolbarPanel.add(toolBar); } }
From source file:org.deegree.igeo.desktop.IGeoDesktop.java
License:Open Source License
private void initFrame() { // remove all listeners and dispose current frame Frame[] frames = Frame.getFrames(); for (Frame frame : frames) { WindowListener[] wl = frame.getWindowListeners(); for (WindowListener windowListener : wl) { frame.removeWindowListener(windowListener); }//from w ww . j ava 2 s . c o m ComponentListener[] cl = frame.getComponentListeners(); for (ComponentListener componentListener : cl) { frame.removeComponentListener(componentListener); } frame.dispose(); } frame = new JFrame(); frame.addWindowListener(new WindowAdapter() { @Override public void windowActivated(WindowEvent e) { // e.g. reorder windows // Frame[] frames = Frame.getFrames(); // for ( Frame fr : frames ) { // if ( !frame.equals( fr ) ) { // fr.toFront(); // } // } // frame.requestFocus(); } }); // add listeners to store window position and size within current project frame.addComponentListener(new ComponentAdapter() { @Override public void componentMoved(ComponentEvent event) { WindowType wt = proj.getView().getWindow(); wt.setLeft((int) event.getComponent().getLocation().getX()); wt.setTop((int) event.getComponent().getLocation().getY()); } @Override public void componentResized(ComponentEvent event) { WindowType wt = proj.getView().getWindow(); wt.setWidth(event.getComponent().getWidth()); wt.setHeight(event.getComponent().getHeight()); resizeToolbar(); } }); // add listeners that ensures that all frames assigned to a project will be (de-)iconified // if main window/frame will be (de-)iconified frame.addWindowListener(new WindowAdapter() { @Override public void windowIconified(WindowEvent e) { Frame[] frames = Frame.getFrames(); for (Frame frame : frames) { frame.setState(Frame.ICONIFIED); } } @Override public void windowDeiconified(WindowEvent e) { Frame[] frames = Frame.getFrames(); for (Frame frame : frames) { frame.setState(Frame.NORMAL); } } }); Component[] comps = this.frame.getContentPane().getComponents(); for (Component component : comps) { this.frame.getContentPane().remove(component); } this.frame.setLocale(Locale.getDefault()); this.frame.getContentPane().removeAll(); this.frame.setName("iGeoDesktop"); this.menuBar = (MenuBar) menuBarController.getView(); this.menuBar.putClientProperty(Options.HEADER_STYLE_KEY, HeaderStyle.BOTH); this.menuBar.removeAll(); this.menuBar.setVisible(true); this.frame.setJMenuBar(this.menuBar); KeyListenerRegister.registerDefaultKeyListener(frame.getRootPane()); // initialize new list for tool bar and menu buttons toolbarButtons = new HashMap<String, List<AbstractButton>>(); menuItems = new HashMap<String, AbstractButton>(); }
From source file:org.kse.gui.KseFrame.java
License:Open Source License
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);/*from w w w .jav a 2 s .com*/ 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(res.getString("KseFrame.jmOpenSpecial.image"))))); 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(res.getString("KseFrame.jmrfRecentFiles.image"))))); PlatformUtil.setMnemonic(jmrfRecentFiles, res.getString("KseFrame.jmrfRecentFiles.mnemonic").charAt(0)); jmrfRecentFiles.putClientProperty(Options.NO_ICONS_KEY, Boolean.TRUE); // For the benefit of the plastic L&F 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); 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(res.getString("KseFrame.jmTabStyle.image"))))); 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); 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(res.getString("KseFrame.jmChangeType.image"))))); PlatformUtil.setMnemonic(jmChangeType, res.getString("KseFrame.jmChangeType.mnemonic").charAt(0)); jmChangeType.setEnabled(false); jmChangeType.putClientProperty(Options.NO_ICONS_KEY, Boolean.TRUE); // For the benefit of the plastic L&F jmTools.add(jmChangeType); 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); 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); 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); jrbmiChangeTypeBksV1 = new JRadioButtonMenuItem(changeTypeBksV1Action); PlatformUtil.setMnemonic(jrbmiChangeTypeBksV1, res.getString("KseFrame.jrbmiChangeTypeBksV1.mnemonic").charAt(0)); jrbmiChangeTypeBksV1.setToolTipText(null); new StatusBarChangeHandler(jrbmiChangeTypeBksV1, (String) changeTypeBksV1Action.getValue(Action.LONG_DESCRIPTION), this); jmChangeType.add(jrbmiChangeTypeBksV1); 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); ButtonGroup changeTypeGroup = new ButtonGroup(); changeTypeGroup.add(jrbmiChangeTypeJks); changeTypeGroup.add(jrbmiChangeTypeJceks); changeTypeGroup.add(jrbmiChangeTypePkcs12); changeTypeGroup.add(jrbmiChangeTypeBks); changeTypeGroup.add(jrbmiChangeTypeBksV1); 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(res.getString("KseFrame.jmOnlineResources.image"))))); 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); jmbMenuBar.putClientProperty(Options.HEADER_STYLE_KEY, HeaderStyle.BOTH); frame.setJMenuBar(jmbMenuBar); }
From source file:org.kse.gui.KseFrame.java
License:Open Source License
private void initToolBar() { jbNew = new JButton(); jbNew.setAction(newAction);// w w w .ja v a2s .c o m jbNew.setText(null); PlatformUtil.setMnemonic(jbNew, 0); jbNew.setFocusable(false); jbNew.addMouseListener(new MouseAdapter() { @Override public void mouseEntered(MouseEvent evt) { setStatusBarText((String) newAction.getValue(Action.LONG_DESCRIPTION)); } @Override public void mouseExited(MouseEvent evt) { setDefaultStatusBarText(); } }); jbOpen = new JButton(); jbOpen.setAction(openAction); jbOpen.setText(null); PlatformUtil.setMnemonic(jbOpen, 0); jbOpen.setFocusable(false); jbOpen.addMouseListener(new MouseAdapter() { @Override public void mouseEntered(MouseEvent evt) { setStatusBarText((String) openAction.getValue(Action.LONG_DESCRIPTION)); } @Override public void mouseExited(MouseEvent evt) { setDefaultStatusBarText(); } }); jbSave = new JButton(); jbSave.setAction(saveAction); jbSave.setText(null); PlatformUtil.setMnemonic(jbSave, 0); jbSave.setFocusable(false); jbSave.addMouseListener(new MouseAdapter() { @Override public void mouseEntered(MouseEvent evt) { setStatusBarText((String) saveAction.getValue(Action.LONG_DESCRIPTION)); } @Override public void mouseExited(MouseEvent evt) { setDefaultStatusBarText(); } }); jbUndo = new JButton(); jbUndo.setAction(undoAction); jbUndo.setText(null); PlatformUtil.setMnemonic(jbUndo, 0); jbUndo.setHideActionText(true); // Ensure text is not displayed when // changed dynamically // later on action jbUndo.setFocusable(false); jbUndo.addMouseListener(new MouseAdapter() { @Override public void mouseEntered(MouseEvent evt) { setStatusBarText((String) undoAction.getValue(Action.LONG_DESCRIPTION)); } @Override public void mouseExited(MouseEvent evt) { setDefaultStatusBarText(); } }); jbRedo = new JButton(); jbRedo.setAction(redoAction); jbRedo.setText(null); PlatformUtil.setMnemonic(jbRedo, 0); jbRedo.setHideActionText(true); // Ensure text is not displayed when // changed dynamically // later on action jbRedo.setFocusable(false); jbRedo.addMouseListener(new MouseAdapter() { @Override public void mouseEntered(MouseEvent evt) { setStatusBarText((String) redoAction.getValue(Action.LONG_DESCRIPTION)); } @Override public void mouseExited(MouseEvent evt) { setDefaultStatusBarText(); } }); jbCut = new JButton(); jbCut.setAction(cutAction); jbCut.setText(null); PlatformUtil.setMnemonic(jbCut, 0); jbCut.setFocusable(false); jbCut.addMouseListener(new MouseAdapter() { @Override public void mouseEntered(MouseEvent evt) { setStatusBarText((String) cutAction.getValue(Action.LONG_DESCRIPTION)); } @Override public void mouseExited(MouseEvent evt) { setDefaultStatusBarText(); } }); jbCopy = new JButton(); jbCopy.setAction(copyAction); jbCopy.setText(null); PlatformUtil.setMnemonic(jbCopy, 0); jbCopy.setFocusable(false); jbCopy.addMouseListener(new MouseAdapter() { @Override public void mouseEntered(MouseEvent evt) { setStatusBarText((String) copyAction.getValue(Action.LONG_DESCRIPTION)); } @Override public void mouseExited(MouseEvent evt) { setDefaultStatusBarText(); } }); jbPaste = new JButton(); jbPaste.setAction(pasteAction); jbPaste.setText(null); PlatformUtil.setMnemonic(jbPaste, 0); jbPaste.setFocusable(false); jbPaste.addMouseListener(new MouseAdapter() { @Override public void mouseEntered(MouseEvent evt) { setStatusBarText((String) pasteAction.getValue(Action.LONG_DESCRIPTION)); } @Override public void mouseExited(MouseEvent evt) { setDefaultStatusBarText(); } }); jbGenerateKeyPair = new JButton(); jbGenerateKeyPair.setAction(generateKeyPairAction); jbGenerateKeyPair.setText(null); PlatformUtil.setMnemonic(jbGenerateKeyPair, 0); jbGenerateKeyPair.setFocusable(false); jbGenerateKeyPair.addMouseListener(new MouseAdapter() { @Override public void mouseEntered(MouseEvent evt) { setStatusBarText((String) generateKeyPairAction.getValue(Action.LONG_DESCRIPTION)); } @Override public void mouseExited(MouseEvent evt) { setDefaultStatusBarText(); } }); jbGenerateSecretKey = new JButton(); jbGenerateSecretKey.setAction(generateSecretKeyAction); jbGenerateSecretKey.setText(null); PlatformUtil.setMnemonic(jbGenerateSecretKey, 0); jbGenerateSecretKey.setFocusable(false); jbGenerateSecretKey.addMouseListener(new MouseAdapter() { @Override public void mouseEntered(MouseEvent evt) { setStatusBarText((String) generateSecretKeyAction.getValue(Action.LONG_DESCRIPTION)); } @Override public void mouseExited(MouseEvent evt) { setDefaultStatusBarText(); } }); jbImportTrustedCertificate = new JButton(); jbImportTrustedCertificate.setAction(importTrustedCertificateAction); jbImportTrustedCertificate.setText(null); PlatformUtil.setMnemonic(jbImportTrustedCertificate, 0); jbImportTrustedCertificate.setFocusable(false); jbImportTrustedCertificate.addMouseListener(new MouseAdapter() { @Override public void mouseEntered(MouseEvent evt) { setStatusBarText((String) importTrustedCertificateAction.getValue(Action.LONG_DESCRIPTION)); } @Override public void mouseExited(MouseEvent evt) { setDefaultStatusBarText(); } }); jbImportKeyPair = new JButton(); jbImportKeyPair.setAction(importKeyPairAction); jbImportKeyPair.setText(null); PlatformUtil.setMnemonic(jbImportKeyPair, 0); jbImportKeyPair.setFocusable(false); jbImportKeyPair.addMouseListener(new MouseAdapter() { @Override public void mouseEntered(MouseEvent evt) { setStatusBarText((String) importKeyPairAction.getValue(Action.LONG_DESCRIPTION)); } @Override public void mouseExited(MouseEvent evt) { setDefaultStatusBarText(); } }); jbSetPassword = new JButton(); jbSetPassword.setAction(setPasswordAction); jbSetPassword.setText(null); PlatformUtil.setMnemonic(jbSetPassword, 0); jbSetPassword.setFocusable(false); jbSetPassword.addMouseListener(new MouseAdapter() { @Override public void mouseEntered(MouseEvent evt) { setStatusBarText((String) setPasswordAction.getValue(Action.LONG_DESCRIPTION)); } @Override public void mouseExited(MouseEvent evt) { setDefaultStatusBarText(); } }); jbProperties = new JButton(); jbProperties.setAction(propertiesAction); jbProperties.setText(null); PlatformUtil.setMnemonic(jbProperties, 0); jbProperties.setFocusable(false); jbProperties.addMouseListener(new MouseAdapter() { @Override public void mouseEntered(MouseEvent evt) { setStatusBarText((String) propertiesAction.getValue(Action.LONG_DESCRIPTION)); } @Override public void mouseExited(MouseEvent evt) { setDefaultStatusBarText(); } }); jbExamineFile = new JButton(); jbExamineFile.setAction(examineFileAction); jbExamineFile.setText(null); PlatformUtil.setMnemonic(jbExamineFile, 0); jbExamineFile.setFocusable(false); jbExamineFile.addMouseListener(new MouseAdapter() { @Override public void mouseEntered(MouseEvent evt) { setStatusBarText((String) examineFileAction.getValue(Action.LONG_DESCRIPTION)); } @Override public void mouseExited(MouseEvent evt) { setDefaultStatusBarText(); } }); jbExamineClipboard = new JButton(); jbExamineClipboard.setAction(examineClipboardAction); jbExamineClipboard.setText(null); PlatformUtil.setMnemonic(jbExamineClipboard, 0); jbExamineClipboard.setFocusable(false); jbExamineClipboard.addMouseListener(new MouseAdapter() { @Override public void mouseEntered(MouseEvent evt) { setStatusBarText((String) examineClipboardAction.getValue(Action.LONG_DESCRIPTION)); } @Override public void mouseExited(MouseEvent evt) { setDefaultStatusBarText(); } }); jbExamineSsl = new JButton(); jbExamineSsl.setAction(examineSslAction); jbExamineSsl.setText(null); PlatformUtil.setMnemonic(jbExamineSsl, 0); jbExamineSsl.setFocusable(false); jbExamineSsl.addMouseListener(new MouseAdapter() { @Override public void mouseEntered(MouseEvent evt) { setStatusBarText((String) examineSslAction.getValue(Action.LONG_DESCRIPTION)); } @Override public void mouseExited(MouseEvent evt) { setDefaultStatusBarText(); } }); jbHelp = new JButton(); jbHelp.setAction(helpAction); jbHelp.setText(null); PlatformUtil.setMnemonic(jbHelp, 0); jbHelp.setFocusable(false); jbHelp.addMouseListener(new MouseAdapter() { @Override public void mouseEntered(MouseEvent evt) { setStatusBarText((String) helpAction.getValue(Action.LONG_DESCRIPTION)); } @Override public void mouseExited(MouseEvent evt) { setDefaultStatusBarText(); } }); jtbToolBar = new JToolBar(); // If using Windows need a bottom line on the toolbar to seperate it // from the main view if (LnfUtil.usingWindowsLnf()) { jtbToolBar.setBorder(new MatteBorder(0, 0, 1, 0, Color.LIGHT_GRAY)); } jtbToolBar.setFloatable(false); jtbToolBar.setRollover(true); jtbToolBar.setName(KSE.getApplicationName()); jtbToolBar.add(jbNew); jtbToolBar.add(jbOpen); jtbToolBar.add(jbSave); jtbToolBar.addSeparator(); jtbToolBar.add(jbUndo); jtbToolBar.add(jbRedo); jtbToolBar.addSeparator(); jtbToolBar.add(jbCut); jtbToolBar.add(jbCopy); jtbToolBar.add(jbPaste); jtbToolBar.addSeparator(); jtbToolBar.add(jbGenerateKeyPair); jtbToolBar.add(jbGenerateSecretKey); jtbToolBar.add(jbImportTrustedCertificate); jtbToolBar.add(jbImportKeyPair); jtbToolBar.add(jbSetPassword); jtbToolBar.add(jbProperties); jtbToolBar.addSeparator(); jtbToolBar.add(jbExamineFile); jtbToolBar.add(jbExamineClipboard); jtbToolBar.add(jbExamineSsl); jtbToolBar.addSeparator(); jtbToolBar.add(jbHelp); jtbToolBar.putClientProperty(Options.HEADER_STYLE_KEY, HeaderStyle.BOTH); if (applicationSettings.getShowToolBar()) { frame.getContentPane().add(jtbToolBar, BorderLayout.NORTH); } }
From source file:org.qedeq.gui.se.main.QedeqMenuBar.java
License:Open Source License
/** * Constructor./* w w w . j a va 2 s .c o m*/ * * @param controller Controller reference. * @param options GUI options to create look specific design. */ public QedeqMenuBar(final QedeqController controller, final GuiOptions options) { this.controller = controller; putClientProperty(Options.HEADER_STYLE_KEY, options.getMenuBarHeaderStyle()); putClientProperty(PlasticLookAndFeel.BORDER_STYLE_KEY, options.getMenuBarPlasticBorderStyle()); putClientProperty(WindowsLookAndFeel.BORDER_STYLE_KEY, options.getMenuBarWindowsBorderStyle()); putClientProperty(PlasticLookAndFeel.IS_3D_KEY, options.getMenuBar3DHint()); add(createFileMenu()); add(createCheckMenu()); add(createTransformMenu()); add(createToolsMenu()); add(createHelpMenu()); }