List of usage examples for java.awt.event KeyEvent VK_H
int VK_H
To view the source code for java.awt.event KeyEvent VK_H.
Click Source Link
From source file:ee.ioc.cs.vsle.editor.Editor.java
/** * Build menu./*w ww .j av a 2 s . co m*/ */ public void makeMenu() { JMenuItem menuItem; JMenu menu; JMenu submenu; menuBar = new JMenuBar(); setJMenuBar(menuBar); menu = new JMenu(Menu.MENU_FILE); menu.setMnemonic(KeyEvent.VK_F); menuItem = new JMenuItem(Menu.NEW_SCHEME, KeyEvent.VK_N); menuItem.addActionListener(getActionListener()); menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_N, ActionEvent.CTRL_MASK)); menu.add(menuItem); menu.addSeparator(); menuItem = new JMenuItem(Menu.LOAD_SCHEME, KeyEvent.VK_O); menuItem.addActionListener(getActionListener()); menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_O, ActionEvent.CTRL_MASK)); menu.add(menuItem); menuItem = new JMenuItem(Menu.RELOAD_SCHEME, KeyEvent.VK_R); menuItem.addActionListener(getActionListener()); menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_R, ActionEvent.CTRL_MASK)); menu.add(menuItem); menu.addSeparator(); menuItem = new JMenuItem(Menu.SAVE_SCHEME, KeyEvent.VK_S); menuItem.addActionListener(getActionListener()); menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_S, ActionEvent.CTRL_MASK)); menu.add(menuItem); menuItem = new JMenuItem(Menu.SAVE_SCHEME_AS); menuItem.addActionListener(getActionListener()); menuItem.setAccelerator( KeyStroke.getKeyStroke(KeyEvent.VK_S, ActionEvent.CTRL_MASK | ActionEvent.SHIFT_MASK)); menu.add(menuItem); menu.addSeparator(); menuItem = new JMenuItem(Menu.DELETE_SCHEME, KeyEvent.VK_D); menuItem.addActionListener(getActionListener()); menu.add(menuItem); submenu = new JMenu(Menu.EXPORT_MENU); menu.add(submenu); //submenu.setMnemonic( KeyEvent.VK_E ); SchemeExporter.makeSchemeExportMenu(submenu, getActionListener()); // Export window graphics submenu.add(GraphicsExporter.getExportMenu()); menu.addSeparator(); menuItem = new JMenuItem(Menu.PRINT, KeyEvent.VK_P); menuItem.addActionListener(getActionListener()); menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_P, ActionEvent.CTRL_MASK)); menu.add(menuItem); menu.addSeparator(); menuItem = new JMenuItem(Menu.EXIT, KeyEvent.VK_X); menuItem.addActionListener(getActionListener()); menu.add(menuItem); menuBar.add(menu); menu = new JMenu(Menu.MENU_EDIT); menu.setMnemonic(KeyEvent.VK_E); menu.add(undoAction); menu.add(redoAction); menu.add(cloneAction); menuItem = new JMenuItem(Menu.SCHEME_FIND, KeyEvent.VK_F); menuItem.addActionListener(getActionListener()); menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F, ActionEvent.CTRL_MASK)); menu.add(menuItem); menuItem = new JMenuItem(Menu.SELECT_ALL, KeyEvent.VK_A); menuItem.addActionListener(getActionListener()); menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_A, ActionEvent.CTRL_MASK)); menu.add(menuItem); menuItem = new JMenuItem(Menu.CLEAR_ALL, KeyEvent.VK_C); menuItem.addActionListener(getActionListener()); menu.add(menuItem); final JCheckBoxMenuItem painterEnabled = new JCheckBoxMenuItem(Menu.CLASSPAINTER, true); painterEnabled.addActionListener(getActionListener()); menu.add(painterEnabled); menu.getPopupMenu().addPopupMenuListener(new PopupMenuListener() { @Override public void popupMenuCanceled(PopupMenuEvent e) { // ignore } @Override public void popupMenuWillBecomeInvisible(PopupMenuEvent e) { // ignore } @Override public void popupMenuWillBecomeVisible(PopupMenuEvent e) { Canvas canvas = Editor.getInstance().getCurrentCanvas(); if (canvas == null || !canvas.getPackage().hasPainters()) { painterEnabled.setVisible(false); } else { painterEnabled.setVisible(true); painterEnabled.setSelected(canvas.isEnableClassPainter()); } } }); menuBar.add(menu); menu = new JMenu(Menu.MENU_VIEW); menu.setMnemonic(KeyEvent.VK_V); gridCheckBox = new JCheckBoxMenuItem(Menu.GRID, RuntimeProperties.isShowGrid()); gridCheckBox.setMnemonic('G'); gridCheckBox.addActionListener(getActionListener()); menu.add(gridCheckBox); ctrlCheckBox = new JCheckBoxMenuItem(Menu.CONTROL_PANEL, RuntimeProperties.isShowControls()); ctrlCheckBox.setMnemonic('C'); ctrlCheckBox.addActionListener(getActionListener()); menu.add(ctrlCheckBox); showPortCheckBox = new JCheckBoxMenuItem(Menu.SHOW_PORTS, true); showPortCheckBox.addActionListener(getActionListener()); menu.add(showPortCheckBox); showObjectNamesCheckBox = new JCheckBoxMenuItem(Menu.SHOW_NAMES, false); showObjectNamesCheckBox.addActionListener(getActionListener()); menu.add(showObjectNamesCheckBox); //sync View with current canvas menu.getPopupMenu().addPopupMenuListener(new PopupMenuListener() { @Override public void popupMenuWillBecomeVisible(PopupMenuEvent e) { Canvas canvas; if ((canvas = getCurrentCanvas()) == null) return; gridCheckBox.setSelected(canvas.isGridVisible()); ctrlCheckBox.setSelected(canvas.isCtrlPanelVisible()); showPortCheckBox.setSelected(canvas.isDrawPorts()); showObjectNamesCheckBox.setSelected(canvas.isShowObjectNames()); } @Override public void popupMenuWillBecomeInvisible(PopupMenuEvent e) { // ignore } @Override public void popupMenuCanceled(PopupMenuEvent e) { // ignore } }); menuBar.add(menu); menu = new JMenu(Menu.MENU_PACKAGE); menu.setMnemonic(KeyEvent.VK_P); menuItem = new JMenuItem(Menu.LOAD, KeyEvent.VK_L); menuItem.addActionListener(getActionListener()); menu.add(menuItem); menuItem = new JMenuItem(Menu.RELOAD, KeyEvent.VK_R); menuItem.addActionListener(getActionListener()); menu.add(menuItem); menuItem = new JMenuItem(Menu.INFO, KeyEvent.VK_I); menuItem.addActionListener(getActionListener()); menu.add(menuItem); if (Desktop.isDesktopSupported()) { menuItem = new JMenuItem(Menu.BROWSE_PACKAGE, KeyEvent.VK_B); menuItem.addActionListener(getActionListener()); menu.add(menuItem); } menuItem = new JMenuItem(Menu.CLOSE, KeyEvent.VK_C); menuItem.addActionListener(getActionListener()); menu.add(menuItem); menuItem = new JMenuItem(Menu.CLOSE_ALL); menuItem.addActionListener(getActionListener()); menu.add(menuItem); menuBar.add(menu); menu.add(new JSeparator()); final JMenu submenuRecent = new JMenu(Menu.RECENT); submenuRecent.getPopupMenu().addPopupMenuListener(new PopupMenuListener() { final JMenuItem empty = new JMenuItem("Empty"); @Override public void popupMenuWillBecomeVisible(PopupMenuEvent e) { makeRecentSubMenu(submenuRecent); if (submenuRecent.getMenuComponentCount() == 0) { submenuRecent.add(empty); empty.setEnabled(false); } else { if (!((submenuRecent.getMenuComponentCount() == 1) && (submenuRecent.getPopupMenu().getComponentIndex(empty) >= -1))) { submenuRecent.remove(empty); } } } @Override public void popupMenuWillBecomeInvisible(PopupMenuEvent e) { // ignore } @Override public void popupMenuCanceled(PopupMenuEvent e) { // ignore } }); menu.add(submenuRecent); final JMenu menuScheme = new JMenu(Menu.MENU_SCHEME); menuScheme.setMnemonic(KeyEvent.VK_S); makeSchemeMenu(menuScheme); menuScheme.getPopupMenu().addPopupMenuListener(new PopupMenuListener() { @Override public void popupMenuWillBecomeVisible(PopupMenuEvent e) { makeSchemeMenu(menuScheme); } @Override public void popupMenuWillBecomeInvisible(PopupMenuEvent e) { // ignore } @Override public void popupMenuCanceled(PopupMenuEvent e) { // ignore } }); /* * menuItem = new JMenuItem("Planner"); * menuItem.addActionListener(aListener); menuScheme.add(menuItem); * menuItem = new JMenuItem("Plan, compile, run"); * menuItem.setActionCommand("Run"); * menuItem.addActionListener(aListener); menuScheme.add(menuItem); */ // menuScheme.setMnemonic(KeyEvent.VK_A); menuBar.add(menuScheme); menu = new JMenu(Menu.MENU_OPTIONS); menu.setMnemonic(KeyEvent.VK_O); menuItem = new JMenuItem(Menu.SETTINGS, KeyEvent.VK_S); menuItem.addActionListener(getActionListener()); menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_J, ActionEvent.CTRL_MASK)); menu.add(menuItem); menuItem = new JMenuItem(Menu.FONTS); menuItem.addActionListener(getActionListener()); menu.add(menuItem); menuItem = new JMenuItem(Menu.SAVE_SETTINGS); menuItem.addActionListener(getActionListener()); menu.add(menuItem); submenu = new JMenu(Menu.MENU_LAF); submenu.setMnemonic(KeyEvent.VK_L); Look.getInstance().createMenuItems(submenu); menu.add(submenu); menuBar.add(menu); makeToolsMenu(menuBar); menu = new JMenu(Menu.MENU_HELP); menu.setMnemonic(KeyEvent.VK_H); menuBar.add(menu); menuItem = new JMenuItem(Menu.DOCS, KeyEvent.VK_D); menuItem.addActionListener(getActionListener()); menu.add(menuItem); }
From source file:be.ac.ua.comp.scarletnebula.gui.windows.GUI.java
private JMenu getHelpMenu() { final JMenu helpMenu = new JMenu("Help"); helpMenu.setMnemonic(KeyEvent.VK_H); // Pick a random message to display in the help menu final String messages[] = { "(You won't find any help here)", "(Nobody can help you)", "(Keep on lookin' if you need help)", "(Heeeeelp!)", "(You might want to try google for help)", "(Try yelling loudly if you need help)" }; final Random generator = new Random(System.currentTimeMillis()); final JMenuItem noHelpItem = new JMenuItem(messages[generator.nextInt(messages.length)]); noHelpItem.setEnabled(false);/*from w ww . ja v a 2 s . com*/ helpMenu.add(noHelpItem); return helpMenu; }
From source file:com.qspin.qtaste.ui.MainPanel.java
protected void genMenu(final TestCaseTree tct) { final JFrame owner = this; JMenuBar menuBar = new JMenuBar(); JMenu tools = new JMenu("Tools"); tools.setMnemonic(KeyEvent.VK_T); // Tools|Config menu item JMenuItem config = new JMenuItem("Config", KeyEvent.VK_D); config.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { //ATEConfigEditPanel configPanel = new ATEConfigEditPanel(null); //configPanel.setVisible(true); MainConfigFrame configFrame = new MainConfigFrame(); configFrame.launch();/*from www . j av a2 s . c o m*/ configFrame.addWindowListener(new WindowListener() { public void windowOpened(WindowEvent e) { } public void windowClosing(WindowEvent e) { } public void windowClosed(WindowEvent e) { // refresh the Configuration information display refreshParams(); } public void windowIconified(WindowEvent e) { } public void windowDeiconified(WindowEvent e) { } public void windowActivated(WindowEvent e) { } public void windowDeactivated(WindowEvent e) { } }); } }); tools.add(config); // Tools|delete results menu item JMenuItem deleteResults = new JMenuItem("Delete Results", KeyEvent.VK_D); final MainPanel ui = this; deleteResults.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { String baseDir = TestEngineConfiguration.getInstance().getString("reporting.generated_report_path"); new File(baseDir, baseDir); // TO DO : delete really the files JOptionPane.showMessageDialog(ui, "Results have been deleted"); } }); tools.add(deleteResults); JMenu fileMenu = new JMenu("File"); JMenuItem importTestSuites = new JMenuItem("Import TestSuites"); importTestSuites.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { // mTestCasePanel.importTestSuites(); } }); fileMenu.add(importTestSuites); JMenu help = new JMenu("Help"); help.setMnemonic(KeyEvent.VK_H); JMenuItem about = new JMenuItem("About", KeyEvent.VK_A); about.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { new AboutDialog(owner); } }); help.add(about); JMenuItem ateUserManuel = new JMenuItem("User Manual"); ateUserManuel.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { viewQTasteUserManuel(); } }); help.add(ateUserManuel); //menuBar.add(tools); // not to be used at this time!!!!!!!!! //menuBar.add(fileMenu); menuBar.add(help); setJMenuBar(menuBar); }
From source file:cl.almejo.vsim.gui.SimWindow.java
private void addMenu() { JMenuBar menuBar = new JMenuBar(); JMenu menu = newMenu(Messages.t("menu.file"), KeyEvent.VK_F, menuBar); menu.add(newMenuItem(NEW_ACTION, Messages.c("menu.file.new.mnemonic"))); menu.add(newMenuItem(OPEN_ACTION, Messages.c("menu.file.open.mnemonic"))); menu.add(newMenuItem(SAVE_ACTION, Messages.c("menu.file.save.mnemonic"))); menu.add(newMenuItem(SAVE_AS_ACTION, Messages.c("menu.file.saveas.mnemonic"))); menu.addSeparator();/*from w w w.ja v a2 s . c o m*/ menu.add(newMenuItem(QUIT_ACTION, Messages.c("menu.file.quit.mnemonic"))); menu = newMenu(Messages.t("menu.edit"), KeyEvent.VK_F, menuBar); menu.add(newMenuItem(CUT_ACTION, Messages.c("menu.edit.cut.mnemonic"))); menu.add(newMenuItem(COPY_ACTION, Messages.c("menu.edit.copy.mnemonic"))); menu.add(newMenuItem(PASTE_ACTION, Messages.c("menu.edit.paste.mnemonic"))); menu.add(newMenuItem(UNDO_ACTION, Messages.c("menu.edit.undo.mnemonic"))); menu.add(newMenuItem(REDO_ACTION, Messages.c("menu.edit.redo.mnemonic"))); menu.add(newMenuItem(PREFERENCES_ACTION, Messages.c("menu.edit.preferences.mnemonic"))); menu = newMenu(Messages.t("menu.view"), KeyEvent.VK_V, menuBar); menu.add(newCheckboxMenuItem(SHOW_GRID_ACTION, Messages.c("menu.view.grid.mnemonic"), true)); menu = newMenu(Messages.t("menu.tools"), KeyEvent.VK_H, menuBar); menu.add(newMenuItem(CURSOR_TOOL_ACTION, Messages.c("menu.tool.cursor.mnemonic"))); menu.add(newMenuItem(MOVE_VIEWPORT_TOOL_ACTION, Messages.c("menu.tool.move.viewport.mnemonic"))); menu.add(newMenuItem(WIRES_TOOL_ACTION, Messages.c("menu.tool.wires.mnemonic"))); menu.add(newMenuItem(AND2_TOOL_ACTION, Messages.c("menu.tool.and2.mnemonic"))); menu.add(newMenuItem(AND3_TOOL_ACTION, Messages.c("menu.tool.and3.mnemonic"))); menu.add(newMenuItem(AND4_TOOL_ACTION, Messages.c("menu.tool.and4.mnemonic"))); menu.add(newMenuItem(OR2_TOOL_ACTION, Messages.c("menu.tool.or2.mnemonic"))); menu.add(newMenuItem(OR3_TOOL_ACTION, Messages.c("menu.tool.or3.mnemonic"))); menu.add(newMenuItem(OR4_TOOL_ACTION, Messages.c("menu.tool.or4.mnemonic"))); menu.add(newMenuItem(XOR2_TOOL_ACTION, Messages.c("menu.tool.or2.mnemonic"))); menu.add(newMenuItem(XOR3_TOOL_ACTION, Messages.c("menu.tool.or3.mnemonic"))); menu.add(newMenuItem(XOR4_TOOL_ACTION, Messages.c("menu.tool.or4.mnemonic"))); menu.add(newMenuItem(CLOCK_TOOL_ACTION, Messages.c("menu.tool.clock.mnemonic"))); menu.add(newMenuItem(NOT_TOOL_ACTION, Messages.c("menu.tool.not.mnemonic"))); menu.add(newMenuItem(FLIP_FLOP_DATA_TOOL_ACTION, Messages.c("menu.tool.flip.flop.data.mnemonic"))); menu.add(newMenuItem(TRISTATE_TOOL_ACTION, Messages.c("menu.tool.tristate.mnemonic"))); menu.add(newMenuItem(SEVEN_SEGMENTS_DISPLAY_TOOL_ACTION, Messages.c("menu.tool.seven.segments.display.mnemonic"))); menu.add(newMenuItem(SEVEN_SEGMENTS_DISPLAY_DOUBLE_TOOL_ACTION, Messages.c("menu.tool.seven.segments.display.double.mnemonic"))); menu.add(newMenuItem(LED_TOOL_ACTION, Messages.c("menu.tool.led.mnemonic"))); menu.add(newMenuItem(TIME_DIAGRAM_TOOL_ACTION, Messages.c("menu.tool.time.diagram.mnemonic"))); menu.add(newMenuItem(SWITCH_TOOL_ACTION, Messages.c("menu.tool.switch.mnemonic"))); menu = newMenu(Messages.t("menu.simulation"), KeyEvent.VK_F, menuBar); menu.add(newMenuItem(START_ACTION, Messages.c("menu.simulation.start.mnemonic"))); menu.add(newMenuItem(PAUSE_ACTION, Messages.c("menu.simulation.pause.mnemonic"))); menu = newMenu(Messages.t("menu.window"), KeyEvent.VK_F, menuBar); menu.add(newMenuItem(CLONE_WINDOW_ACTION, Messages.c("menu.window.clone.mnemonic"))); menu.add(newMenuItem(CLOSE_ACTION, Messages.c("menu.window.close.mnemonic"))); menu = newMenu(Messages.t("menu.help"), KeyEvent.VK_F, menuBar); menu.add(newMenuItem(ONLINE_HELP_ACTION, Messages.c("menu.help.online.mnemonic"))); menu.add(newMenuItem(ABOUT_ACTION, Messages.c("menu.help.about.mnemonic"))); setJMenuBar(menuBar); }
From source file:es.emergya.ui.gis.FleetControlMapViewer.java
@Override protected JPopupMenu getContextMenu() { JPopupMenu menu = new JPopupMenu(); menu.setBackground(Color.decode("#E8EDF6")); // Ttulo//w w w. ja va 2 s . c o m final JMenuItem titulo = new JMenuItem(i18n.getString("map.menu.titulo.puntoGenerico")); titulo.setFont(LogicConstants.deriveBoldFont(10.0f)); titulo.setBackground(Color.decode("#A4A4A4")); titulo.setFocusable(false); menu.add(titulo); menu.addSeparator(); // Actualizar posicin final JMenuItem gps = new JMenuItem(i18n.getString("map.menu.gps"), KeyEvent.VK_P); gps.setIcon(LogicConstants.getIcon("menucontextual_icon_actualizargps")); menu.add(gps); gps.addActionListener(this); gps.setEnabled(false); menu.addSeparator(); // Mostrar ms cercanos final JMenuItem mmc = new JMenuItem(i18n.getString("map.menu.showNearest"), KeyEvent.VK_M); mmc.setIcon(LogicConstants.getIcon("menucontextual_icon_mascercano")); mmc.addActionListener(this); menu.add(mmc); // Centrar aqui final JMenuItem cent = new JMenuItem(i18n.getString("map.menu.centerHere"), KeyEvent.VK_C); cent.setIcon(LogicConstants.getIcon("menucontextual_icon_centrar")); cent.addActionListener(this); menu.add(cent); // Nueva Incidencia final JMenuItem newIncidence = new JMenuItem(i18n.getString("map.menu.newIncidence"), KeyEvent.VK_I); newIncidence.setIcon(LogicConstants.getIcon("menucontextual_icon_newIncidence")); newIncidence.addActionListener(this); menu.add(newIncidence); // Calcular ruta desde aqui final JMenuItem from = new JMenuItem(i18n.getString("map.menu.route.from"), KeyEvent.VK_D); from.setIcon(LogicConstants.getIcon("menucontextual_icon_origenruta")); from.addActionListener(this); menu.add(from); // Calcular ruta hasta aqui final JMenuItem to = new JMenuItem(i18n.getString("map.menu.route.to"), KeyEvent.VK_H); to.setIcon(LogicConstants.getIcon("menucontextual_icon_destinoruta")); to.addActionListener(this); menu.add(to); menu.addSeparator(); // Ver ficha [recurso / incidencia] final JMenuItem summary = new JMenuItem(i18n.getString("map.menu.summary"), KeyEvent.VK_F); summary.setIcon(LogicConstants.getIcon("menucontextual_icon_ficha")); summary.addActionListener(this); menu.add(summary); summary.setEnabled(false); menu.addPopupMenuListener(new PopupMenuListener() { @SuppressWarnings("unchecked") @Override public void popupMenuWillBecomeVisible(PopupMenuEvent e) { eventOriginal = FleetControlMapViewer.this.mapView.lastMEvent; gps.setEnabled(false); summary.setEnabled(false); titulo.setText(i18n.getString("map.menu.titulo.puntoGenerico")); menuObjective = null; Point p = new Point(mapView.lastMEvent.getX(), mapView.lastMEvent.getY()); for (Layer l : mapView.getAllLayers()) { // por cada capa... if (l instanceof MarkerLayer) { // ...de marcadores for (Marker marker : ((MarkerLayer) l).data) { // miramos // los // marcadores if ((marker instanceof CustomMarker) && marker.containsPoint(p)) { // y si // estamos // pinchando // en uno CustomMarker m = (CustomMarker) marker; log.trace("Hemos pinchado en " + marker); switch (m.getType()) { case RESOURCE: Recurso r = (Recurso) m.getObject(); log.trace("Es un recurso: " + r); if (r != null) { menuObjective = r; if (r.getPatrullas() != null) { titulo.setText( i18n.getString(Locale.ROOT, "map.menu.titulo.recursoPatrulla", r.getIdentificador(), r.getPatrullas())); } else { titulo.setText(r.getIdentificador()); } gps.setEnabled(true); summary.setEnabled(true); } break; case INCIDENCE: Incidencia i = (Incidencia) m.getObject(); log.trace("Es una incidencia: " + i); if (i != null) { menuObjective = i; titulo.setText(i.getTitulo()); gps.setEnabled(false); summary.setEnabled(true); } break; case UNKNOWN: log.trace("Hemos pinchado en un marcador desconocido"); break; } } } } } } @Override public void popupMenuWillBecomeInvisible(PopupMenuEvent e) { } @Override public void popupMenuCanceled(PopupMenuEvent e) { } }); return menu; }
From source file:Utilities.java
private static boolean usableKeyOnMac(int key, int mask) { //All permutations fail for Q except ctrl if (key == KeyEvent.VK_Q) { return false; }//from w w w . jav a2s .c om boolean isMeta = ((mask & KeyEvent.META_MASK) != 0) || ((mask & KeyEvent.CTRL_DOWN_MASK) != 0); boolean isAlt = ((mask & KeyEvent.ALT_MASK) != 0) || ((mask & KeyEvent.ALT_DOWN_MASK) != 0); boolean isOnlyMeta = isMeta && ((mask & ~(KeyEvent.META_DOWN_MASK | KeyEvent.META_MASK)) == 0); //Mac OS consumes keys Command+ these keys - the app will never see //them, so CTRL should not be remapped for these if (isOnlyMeta) { return (key != KeyEvent.VK_H) && (key != KeyEvent.VK_SPACE) && (key != KeyEvent.VK_TAB); } else return !((key == KeyEvent.VK_D) && isMeta && isAlt); }
From source file:com.eviware.soapui.SoapUI.java
private JMenu buildHelpMenu() { helpMenu = new JMenu("Help"); helpMenu.setMnemonic(KeyEvent.VK_H); helpMenu.add(new ShowPushPageAction()); helpMenu.addSeparator();/*from w ww.j av a 2 s.co m*/ helpMenu.add(new ShowOnlineHelpAction("User Guide", HelpUrls.USERGUIDE_HELP_URL)); helpMenu.add(new ShowOnlineHelpAction("Getting Started", HelpUrls.GETTINGSTARTED_HELP_URL)); helpMenu.add(new SearchForumAction()); helpMenu.addSeparator(); helpMenu.add(new ShowSystemPropertiesAction()); helpMenu.addSeparator(); helpMenu.add(new VersionUpdateAction()); helpMenu.addSeparator(); helpMenu.add(new ShowOnlineHelpAction("soapUI Pro Trial", HelpUrls.TRIAL_URL, "Apply for soapUI Pro Trial License", "/favicon.png")); helpMenu.addSeparator(); helpMenu.add(new OpenUrlAction("soapui.org", "http://www.soapui.org")); helpMenu.add(new OpenUrlAction("smartbear.com", "http://smartbear.com")); helpMenu.addSeparator(); helpMenu.add(new AboutAction()); return helpMenu; }
From source file:edu.harvard.mcz.imagecapture.MainFrame.java
/** * This method initializes jMenuHelp //from ww w . j av a 2 s. c o m * * @return javax.swing.JMenu */ private JMenu getJMenuHelp() { if (jMenuHelp == null) { jMenuHelp = new JMenu(); jMenuHelp.setText("Help"); jMenuHelp.setMnemonic(KeyEvent.VK_H); jMenuHelp.add(getJMenuItemAbout()); jMenuHelp.addSeparator(); jMenuHelp.add(getJMenuItem()); jMenuHelp.add(getJMenuItemVersion()); } return jMenuHelp; }
From source file:burlov.ultracipher.swing.SwingGuiApplication.java
private JMenuBar createMenuBar() { JMenuBar bar = new JMenuBar(); JMenu menu = null;/*from w w w . j a va 2 s . c o m*/ /* * 'File' Menue */ menu = new JMenu("File"); menu.setMnemonic(KeyEvent.VK_F); bar.add(menu); JMenuItem item = new JMenuItem("Save database"); item.setAccelerator(KeyStroke.getKeyStroke("control S")); item.setMnemonic(KeyEvent.VK_S); item.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { saveDatabase(); } }); menu.add(item); item = new JMenuItem("Download database"); item.setMnemonic(KeyEvent.VK_L); item.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { downloadAndMergeData(); } }); menu.add(item); item = new JMenuItem("Edit sync account"); item.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { editSyncAccount(); } }); menu.add(item); menu.add(new JSeparator()); JMenu submenu = new JMenu("Import"); menu.add(submenu); item = new JMenuItem("From CSV"); item.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { importCSV(); } }); submenu.add(item); submenu = new JMenu("Export"); menu.add(submenu); item = new JMenuItem("As CSV"); item.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { exportCSV(); } }); submenu.add(item); item = new JMenuItem("Change passphrase"); menu.add(item); item.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { changePassword(); } }); /* * 'Edit' Menue */ menu = new JMenu("Edit"); menu.setMnemonic(KeyEvent.VK_E); bar.add(menu); item = menu.add(mainPanel.getNewEntryAction()); item.setMnemonic(KeyEvent.VK_N); item = menu.add(mainPanel.getDeleteEntryAction()); item.setMnemonic(KeyEvent.VK_D); menu.add(new JSeparator()); menu = new JMenu("Tools"); // item = new JMenuItem("Passwort generator"); // menu.add(item); // item.addActionListener(new ActionListener() { // // @Override // public void actionPerformed(ActionEvent e) { // passGenerator.setVisible(false); // passGenerator.setLocationRelativeTo(getMainFrame()); // passGenerator.setVisible(true); // } // }); item = new JMenuItem("Screen keyboard"); menu.add(item); item.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { screenKeyboard.setLocationRelativeTo(getMainFrame()); screenKeyboard.setVisible(true); } }); item = new JMenuItem("File digester"); menu.add(item); item.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { digester.setLocationRelativeTo(getMainFrame()); digester.setVisible(true); } }); bar.add(menu); /* * 'Help' Menue */ menu = new JMenu("Help"); menu.setMnemonic(KeyEvent.VK_H); bar.add(menu); item = new JMenuItem("Performance test"); menu.add(item); item.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { measurePerformance(); } }); item = new JMenuItem("System info"); menu.add(item); item.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { showSystemInfo(); } }); item = new JMenuItem("About"); menu.add(item); item.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { String text = "<html>Ultracipher 6.1<br>(C) Copyright 2015 Paul Burlov<br><br>" + "Encryption strength: 768Bit (6 x 128Bit keys)<br>Cipher cascade: AES/Twofish/Serpent/CAST6/SEED/Camellia" + "<br>Encryption mode: Two pass CBC" + "<br>Key derivation algorithm: SCrypt with N=2^14,P=8,R=1<br><br> " + "This product includes software developed by the<br>" + "<ul><li>Apache Software Foundation " + "<a href='http://www.apache.org'>http://www.apache.org</a>" + "<li>Legion of the Bouncy Castle <a href='http://bouncycastle.org/'>http://bouncycastle.org</a>" + "<li>Project SwingX" + "<li>Bytecode Pty Ltd." + "</ul></html>"; JOptionPane.showMessageDialog(getMainFrame(), text, "", JOptionPane.INFORMATION_MESSAGE, getAppIcon()); } }); bar.add(Box.createHorizontalGlue()); menu = new JMenu("Keyboard"); ButtonGroup group = new ButtonGroup(); JRadioButtonMenuItem radioitem = new JRadioButtonMenuItem("System"); radioitem.setSelected(true); group.add(radioitem); radioitem.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { translator.resetMapping(); } }); menu.add(radioitem); radioitem = new JRadioButtonMenuItem("Futhark runes"); group.add(radioitem); radioitem.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { translator.initForFuthark(); } }); menu.add(radioitem); radioitem = new JRadioButtonMenuItem("Anglo-Saxon runes"); group.add(radioitem); radioitem.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { translator.initForAngloSaxon(); } }); menu.add(radioitem); bar.add(menu); // bar.add(Box.createHorizontalGlue()); // bar.add(new PassGeneratorPanel()); return bar; }
From source file:org.rdv.ui.MainPanel.java
private void initActions() { fileAction = new DataViewerAction("File", "File Menu", KeyEvent.VK_F); connectAction = new DataViewerAction("Connect", "Connect to RBNB server", KeyEvent.VK_C, KeyStroke.getKeyStroke(KeyEvent.VK_C, menuShortcutKeyMask | ActionEvent.SHIFT_MASK)) { /** serialization version identifier */ private static final long serialVersionUID = 5038790506859429244L; public void actionPerformed(ActionEvent ae) { if (rbnbConnectionDialog == null) { rbnbConnectionDialog = new RBNBConnectionDialog(frame, rbnb, dataPanelManager); } else { rbnbConnectionDialog.setVisible(true); }//from w ww . j av a2 s . co m } }; disconnectAction = new DataViewerAction("Disconnect", "Disconnect from RBNB server", KeyEvent.VK_D, KeyStroke.getKeyStroke(KeyEvent.VK_D, menuShortcutKeyMask | ActionEvent.SHIFT_MASK)) { /** serialization version identifier */ private static final long serialVersionUID = -1871076535376405181L; public void actionPerformed(ActionEvent ae) { dataPanelManager.closeAllDataPanels(); rbnb.disconnect(); } }; loginAction = new DataViewerAction("Login", "Login as a NEES user") { /** serialization version identifier */ private static final long serialVersionUID = 6105503896620555072L; public void actionPerformed(ActionEvent ae) { if (loginDialog == null) { loginDialog = new LoginDialog(frame); } else { loginDialog.setVisible(true); } } }; logoutAction = new DataViewerAction("Logout", "Logout as a NEES user") { /** serialization version identifier */ private static final long serialVersionUID = -2517567766044673777L; public void actionPerformed(ActionEvent ae) { AuthenticationManager.getInstance().setAuthentication(null); } }; loadAction = new DataViewerAction("Load Setup", "Load data viewer setup from file") { /** serialization version identifier */ private static final long serialVersionUID = 7197815395398039821L; public void actionPerformed(ActionEvent ae) { File configFile = UIUtilities.getFile(new RDVConfigurationFileFilter(), "Load"); if (configFile != null) { try { URL configURL = configFile.toURI().toURL(); ConfigurationManager.loadConfiguration(configURL); } catch (MalformedURLException e) { DataViewer.alertError("\"" + configFile + "\" is not a valid configuration file URL."); } } } }; saveAction = new DataViewerAction("Save Setup", "Save data viewer setup to file") { /** serialization version identifier */ private static final long serialVersionUID = -8259994975940624038L; public void actionPerformed(ActionEvent ae) { File file = UIUtilities.saveFile(new RDVConfigurationFileFilter()); if (file != null) { if (file.getName().indexOf(".") == -1) { file = new File(file.getAbsolutePath() + ".rdv"); } // prompt for overwrite if file already exists if (file.exists()) { int overwriteReturn = JOptionPane.showConfirmDialog(null, file.getName() + " already exists. Do you want to overwrite it?", "Overwrite file?", JOptionPane.YES_NO_OPTION); if (overwriteReturn == JOptionPane.NO_OPTION) { return; } } ConfigurationManager.saveConfiguration(file); } } }; importAction = new DataViewerAction("Import", "Import Menu", KeyEvent.VK_I, "icons/import.gif"); exportAction = new DataViewerAction("Export", "Export Menu", KeyEvent.VK_E, "icons/export.gif"); exportVideoAction = new DataViewerAction("Export video channels", "Export video on the server to the local computer") { /** serialization version identifier */ private static final long serialVersionUID = -6420430928972633313L; public void actionPerformed(ActionEvent ae) { showExportVideoDialog(); } }; exitAction = new DataViewerAction("Exit", "Exit RDV", KeyEvent.VK_X) { /** serialization version identifier */ private static final long serialVersionUID = 3137490972014710133L; public void actionPerformed(ActionEvent ae) { Application.getInstance().exit(ae); } }; controlAction = new DataViewerAction("Control", "Control Menu", KeyEvent.VK_C); realTimeAction = new DataViewerAction("Real Time", "View data in real time", KeyEvent.VK_R, KeyStroke.getKeyStroke(KeyEvent.VK_R, menuShortcutKeyMask), "icons/rt.gif") { /** serialization version identifier */ private static final long serialVersionUID = -7564783609370910512L; public void actionPerformed(ActionEvent ae) { rbnb.monitor(); } }; playAction = new DataViewerAction("Play", "Playback data", KeyEvent.VK_P, KeyStroke.getKeyStroke(KeyEvent.VK_P, menuShortcutKeyMask), "icons/play.gif") { /** serialization version identifier */ private static final long serialVersionUID = 5974457444931142938L; public void actionPerformed(ActionEvent ae) { rbnb.play(); } }; pauseAction = new DataViewerAction("Pause", "Pause data display", KeyEvent.VK_A, KeyStroke.getKeyStroke(KeyEvent.VK_S, menuShortcutKeyMask), "icons/pause.gif") { /** serialization version identifier */ private static final long serialVersionUID = -5297742186923194460L; public void actionPerformed(ActionEvent ae) { rbnb.pause(); } }; beginningAction = new DataViewerAction("Go to beginning", "Move the location to the start of the data", KeyEvent.VK_B, KeyStroke.getKeyStroke(KeyEvent.VK_B, menuShortcutKeyMask), "icons/begin.gif") { /** serialization version identifier */ private static final long serialVersionUID = 9171304956895497898L; public void actionPerformed(ActionEvent ae) { controlPanel.setLocationBegin(); } }; endAction = new DataViewerAction("Go to end", "Move the location to the end of the data", KeyEvent.VK_E, KeyStroke.getKeyStroke(KeyEvent.VK_E, menuShortcutKeyMask), "icons/end.gif") { /** serialization version identifier */ private static final long serialVersionUID = 1798579248452726211L; public void actionPerformed(ActionEvent ae) { controlPanel.setLocationEnd(); } }; gotoTimeAction = new DataViewerAction("Go to time", "Move the location to specific date time of the data", KeyEvent.VK_T, KeyStroke.getKeyStroke(KeyEvent.VK_T, menuShortcutKeyMask)) { /** serialization version identifier */ private static final long serialVersionUID = -6411442297488926326L; public void actionPerformed(ActionEvent ae) { TimeRange timeRange = RBNBHelper.getChannelsTimeRange(); double time = DateTimeDialog.showDialog(frame, rbnb.getLocation(), timeRange.start, timeRange.end); if (time >= 0) { rbnb.setLocation(time); } } }; updateChannelListAction = new DataViewerAction("Update Channel List", "Update the channel list", KeyEvent.VK_U, KeyStroke.getKeyStroke(KeyEvent.VK_F5, 0), "icons/refresh.gif") { /** serialization version identifier */ private static final long serialVersionUID = -170096772973697277L; public void actionPerformed(ActionEvent ae) { rbnb.updateMetadata(); } }; dropDataAction = new DataViewerAction("Drop Data", "Drop data if plaback can't keep up with data rate", KeyEvent.VK_D, "icons/drop_data.gif") { /** serialization version identifier */ private static final long serialVersionUID = 7079791364881120134L; public void actionPerformed(ActionEvent ae) { JCheckBoxMenuItem menuItem = (JCheckBoxMenuItem) ae.getSource(); rbnb.dropData(menuItem.isSelected()); } }; viewAction = new DataViewerAction("View", "View Menu", KeyEvent.VK_V); showChannelListAction = new DataViewerAction("Show Channels", "", KeyEvent.VK_L, "icons/channels.gif") { /** serialization version identifier */ private static final long serialVersionUID = 4982129759386009112L; public void actionPerformed(ActionEvent ae) { JCheckBoxMenuItem menuItem = (JCheckBoxMenuItem) ae.getSource(); channelListPanel.setVisible(menuItem.isSelected()); layoutSplitPane(); leftPanel.resetToPreferredSizes(); } }; showMetadataPanelAction = new DataViewerAction("Show Properties", "", KeyEvent.VK_P, "icons/properties.gif") { /** serialization version identifier */ private static final long serialVersionUID = 430106771704397810L; public void actionPerformed(ActionEvent ae) { JCheckBoxMenuItem menuItem = (JCheckBoxMenuItem) ae.getSource(); metadataPanel.setVisible(menuItem.isSelected()); layoutSplitPane(); leftPanel.resetToPreferredSizes(); } }; showControlPanelAction = new DataViewerAction("Show Control Panel", "", KeyEvent.VK_C, "icons/control.gif") { /** serialization version identifier */ private static final long serialVersionUID = 6401715717710735485L; public void actionPerformed(ActionEvent ae) { JCheckBoxMenuItem menuItem = (JCheckBoxMenuItem) ae.getSource(); controlPanel.setVisible(menuItem.isSelected()); } }; showAudioPlayerPanelAction = new DataViewerAction("Show Audio Player", "", KeyEvent.VK_A, "icons/audio.gif") { /** serialization version identifier */ private static final long serialVersionUID = -4248275698973916287L; public void actionPerformed(ActionEvent ae) { JCheckBoxMenuItem menuItem = (JCheckBoxMenuItem) ae.getSource(); audioPlayerPanel.setVisible(menuItem.isSelected()); } }; showMarkerPanelAction = new DataViewerAction("Show Marker Panel", "", KeyEvent.VK_M, "icons/info.gif") { /** serialization version identifier */ private static final long serialVersionUID = -5253555511660929640L; public void actionPerformed(ActionEvent ae) { JCheckBoxMenuItem menuItem = (JCheckBoxMenuItem) ae.getSource(); markerSubmitPanel.setVisible(menuItem.isSelected()); } }; dataPanelAction = new DataViewerAction("Arrange", "Arrange Data Panel Orientation", KeyEvent.VK_D); dataPanelHorizontalLayoutAction = new DataViewerAction("Horizontal Data Panel Orientation", "", -1, "icons/vertical.gif") { /** serialization version identifier */ private static final long serialVersionUID = 3356151813557187908L; public void actionPerformed(ActionEvent ae) { dataPanelContainer.setLayout(DataPanelContainer.VERTICAL_LAYOUT); } }; dataPanelVerticalLayoutAction = new DataViewerAction("Vertical Data Panel Orientation", "", -1, "icons/horizontal.gif") { /** serialization version identifier */ private static final long serialVersionUID = -4629920180285927138L; public void actionPerformed(ActionEvent ae) { dataPanelContainer.setLayout(DataPanelContainer.HORIZONTAL_LAYOUT); } }; showHiddenChannelsAction = new DataViewerAction("Show Hidden Channels", "", KeyEvent.VK_H, KeyStroke.getKeyStroke(KeyEvent.VK_H, menuShortcutKeyMask), "icons/hidden.gif") { /** serialization version identifier */ private static final long serialVersionUID = -2723464261568074033L; public void actionPerformed(ActionEvent ae) { JCheckBoxMenuItem menuItem = (JCheckBoxMenuItem) ae.getSource(); boolean selected = menuItem.isSelected(); channelListPanel.showHiddenChannels(selected); } }; hideEmptyTimeAction = new DataViewerAction("Hide time with no data", "", KeyEvent.VK_D) { /** serialization version identifier */ private static final long serialVersionUID = -3123608144249355642L; public void actionPerformed(ActionEvent ae) { JCheckBoxMenuItem menuItem = (JCheckBoxMenuItem) ae.getSource(); boolean selected = menuItem.isSelected(); controlPanel.hideEmptyTime(selected); } }; fullScreenAction = new DataViewerAction("Full Screen", "", KeyEvent.VK_F, KeyStroke.getKeyStroke(KeyEvent.VK_F11, 0)) { /** serialization version identifier */ private static final long serialVersionUID = -6882310862616235602L; public void actionPerformed(ActionEvent ae) { JCheckBoxMenuItem menuItem = (JCheckBoxMenuItem) ae.getSource(); if (menuItem.isSelected()) { if (enterFullScreenMode()) { menuItem.setSelected(true); } else { menuItem.setSelected(false); } } else { leaveFullScreenMode(); menuItem.setSelected(false); } } }; windowAction = new DataViewerAction("Window", "Window Menu", KeyEvent.VK_W); closeAllDataPanelsAction = new DataViewerAction("Close all data panels", "", KeyEvent.VK_C, "icons/closeall.gif") { /** serialization version identifier */ private static final long serialVersionUID = -8104876009869238037L; public void actionPerformed(ActionEvent ae) { dataPanelManager.closeAllDataPanels(); } }; helpAction = new DataViewerAction("Help", "Help Menu", KeyEvent.VK_H); usersGuideAction = new DataViewerAction("RDV Help", "Open the RDV User's Guide", KeyEvent.VK_H, KeyStroke.getKeyStroke(KeyEvent.VK_F1, 0)) { /** serialization version identifier */ private static final long serialVersionUID = -2837190869008153291L; public void actionPerformed(ActionEvent ae) { try { URL usersGuideURL = new URL("http://it.nees.org/library/telepresence/rdv-19-users-guide.php"); DataViewer.browse(usersGuideURL); } catch (Exception e) { } } }; supportAction = new DataViewerAction("RDV Support", "Get support from NEESit", KeyEvent.VK_S) { /** serialization version identifier */ private static final long serialVersionUID = -6855670513381679226L; public void actionPerformed(ActionEvent ae) { try { URL supportURL = new URL("http://it.nees.org/support/"); DataViewer.browse(supportURL); } catch (Exception e) { } } }; releaseNotesAction = new DataViewerAction("Release Notes", "Open the RDV Release Notes", KeyEvent.VK_R) { /** serialization version identifier */ private static final long serialVersionUID = 7223639998298692494L; public void actionPerformed(ActionEvent ae) { try { URL releaseNotesURL = new URL("http://it.nees.org/library/rdv/rdv-release-notes.php"); DataViewer.browse(releaseNotesURL); } catch (Exception e) { } } }; aboutAction = new DataViewerAction("About RDV", "", KeyEvent.VK_A) { /** serialization version identifier */ private static final long serialVersionUID = 3978467903181198979L; public void actionPerformed(ActionEvent ae) { showAboutDialog(); } }; }