List of usage examples for java.awt.event KeyEvent VK_T
int VK_T
To view the source code for java.awt.event KeyEvent VK_T.
Click Source Link
From source file:DragColorTextFieldDemo.java
public JMenuBar createMenuBar() { JMenuItem menuItem = null;/* w ww.j a v a2 s . co m*/ JMenuBar menuBar = new JMenuBar(); JMenu mainMenu = new JMenu("Edit"); mainMenu.setMnemonic(KeyEvent.VK_E); menuItem = new JMenuItem(new DefaultEditorKit.CutAction()); menuItem.setText("Cut"); menuItem.setMnemonic(KeyEvent.VK_T); mainMenu.add(menuItem); menuItem = new JMenuItem(new DefaultEditorKit.CopyAction()); menuItem.setText("Copy"); menuItem.setMnemonic(KeyEvent.VK_C); mainMenu.add(menuItem); menuItem = new JMenuItem(new DefaultEditorKit.PasteAction()); menuItem.setText("Paste"); menuItem.setMnemonic(KeyEvent.VK_P); mainMenu.add(menuItem); menuBar.add(mainMenu); return menuBar; }
From source file:org.apache.jackrabbit.oak.explorer.Explorer.java
private void createAndShowGUI(final File path, boolean skipSizeCheck) throws IOException { JTextArea log = new JTextArea(5, 20); log.setMargin(new Insets(5, 5, 5, 5)); log.setLineWrap(true);/*from ww w . j a v a 2s . c o m*/ log.setEditable(false); final NodeStoreTree treePanel = new NodeStoreTree(backend, log, skipSizeCheck); final JFrame frame = new JFrame("Explore " + path + " @head"); frame.addWindowListener(new java.awt.event.WindowAdapter() { @Override public void windowClosing(java.awt.event.WindowEvent windowEvent) { IOUtils.closeQuietly(treePanel); System.exit(0); } }); JPanel content = new JPanel(new GridBagLayout()); GridBagConstraints c = new GridBagConstraints(); c.fill = GridBagConstraints.BOTH; c.weightx = 1; c.weighty = 1; JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, new JScrollPane(treePanel), new JScrollPane(log)); splitPane.setDividerLocation(0.3); content.add(new JScrollPane(splitPane), c); frame.getContentPane().add(content); JMenuBar menuBar = new JMenuBar(); menuBar.setMargin(new Insets(2, 2, 2, 2)); JMenuItem menuReopen = new JMenuItem("Reopen"); menuReopen.setMnemonic(KeyEvent.VK_R); menuReopen.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ev) { try { treePanel.reopen(); } catch (IOException e) { throw new RuntimeException(e); } } }); JMenuItem menuCompaction = new JMenuItem("Time Machine"); menuCompaction.setMnemonic(KeyEvent.VK_T); menuCompaction.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ev) { List<String> revs = backend.readRevisions(); String s = (String) JOptionPane.showInputDialog(frame, "Revert to a specified revision", "Time Machine", JOptionPane.PLAIN_MESSAGE, null, revs.toArray(), revs.get(0)); if (s != null && treePanel.revert(s)) { frame.setTitle("Explore " + path + " @" + s); } } }); JMenuItem menuRefs = new JMenuItem("Tar File Info"); menuRefs.setMnemonic(KeyEvent.VK_I); menuRefs.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ev) { List<String> tarFiles = new ArrayList<String>(); for (File f : path.listFiles()) { if (f.getName().endsWith(".tar")) { tarFiles.add(f.getName()); } } String s = (String) JOptionPane.showInputDialog(frame, "Choose a tar file", "Tar File Info", JOptionPane.PLAIN_MESSAGE, null, tarFiles.toArray(), tarFiles.get(0)); if (s != null) { treePanel.printTarInfo(s); } } }); JMenuItem menuSCR = new JMenuItem("Segment Refs"); menuSCR.setMnemonic(KeyEvent.VK_R); menuSCR.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ev) { String s = JOptionPane.showInputDialog(frame, "Segment References\nUsage: <segmentId>", "Segment References", JOptionPane.PLAIN_MESSAGE); if (s != null) { treePanel.printSegmentReferences(s); } } }); JMenuItem menuDiff = new JMenuItem("SegmentNodeState diff"); menuDiff.setMnemonic(KeyEvent.VK_D); menuDiff.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ev) { String s = JOptionPane.showInputDialog(frame, "SegmentNodeState diff\nUsage: <recordId> <recordId> [<path>]", "SegmentNodeState diff", JOptionPane.PLAIN_MESSAGE); if (s != null) { treePanel.printDiff(s); } } }); JMenuItem menuPCM = new JMenuItem("Persisted Compaction Maps"); menuPCM.setMnemonic(KeyEvent.VK_P); menuPCM.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ev) { treePanel.printPCMInfo(); } }); menuBar.add(menuReopen); menuBar.add(new JSeparator(JSeparator.VERTICAL)); menuBar.add(menuCompaction); menuBar.add(new JSeparator(JSeparator.VERTICAL)); menuBar.add(menuRefs); menuBar.add(new JSeparator(JSeparator.VERTICAL)); menuBar.add(menuSCR); menuBar.add(new JSeparator(JSeparator.VERTICAL)); menuBar.add(menuDiff); menuBar.add(new JSeparator(JSeparator.VERTICAL)); menuBar.add(menuPCM); menuBar.add(new JSeparator(JSeparator.VERTICAL)); frame.setJMenuBar(menuBar); frame.pack(); frame.setSize(960, 720); frame.setLocationRelativeTo(null); frame.setVisible(true); }
From source file:org.eurocarbdb.application.glycoworkbench.plugin.AnnotationReportApplet.java
private void createActions() { //file// w w w .j a v a 2 s .co m theActionManager.add("print", FileUtils.defaultThemeManager.getImageIcon("print"), "Print...", KeyEvent.VK_P, "ctrl P", this); //edit theActionManager.add("undo", FileUtils.defaultThemeManager.getImageIcon("undo"), "Undo", KeyEvent.VK_U, "ctrl Z", this); theActionManager.add("redo", FileUtils.defaultThemeManager.getImageIcon("redo"), "Redo", KeyEvent.VK_R, "ctrl Y", this); theActionManager.add("cut", FileUtils.defaultThemeManager.getImageIcon("cut"), "Cut", KeyEvent.VK_T, "ctrl X", this); theActionManager.add("copy", FileUtils.defaultThemeManager.getImageIcon("copy"), "Copy", KeyEvent.VK_C, "ctrl C", this); theActionManager.add("delete", FileUtils.defaultThemeManager.getImageIcon("delete"), "Delete", KeyEvent.VK_DELETE, "", this); theActionManager.add("screenshot", FileUtils.defaultThemeManager.getImageIcon("screenshot"), "Screenshot", KeyEvent.VK_PRINTSCREEN, "PRINTSCREEN", this); theActionManager.add("selectall", FileUtils.defaultThemeManager.getImageIcon("selectall"), "Select all", KeyEvent.VK_A, "ctrl A", this); theActionManager.add("selectnone", FileUtils.defaultThemeManager.getImageIcon("selectnone"), "Select none", KeyEvent.VK_E, "ESCAPE", this); theActionManager.add("enlarge", FileUtils.defaultThemeManager.getImageIcon("enlarge"), "Enlarge selected structures", -1, "", this); theActionManager.add("resetsize", FileUtils.defaultThemeManager.getImageIcon("resetsize"), "Reset size of selected structures to default value", -1, "", this); theActionManager.add("shrink", FileUtils.defaultThemeManager.getImageIcon("shrink"), "Shrink selected structures", -1, "", this); theActionManager.add("ungroup", FileUtils.defaultThemeManager.getImageIcon("ungroup"), "Ungroup selected structures", -1, "", this); theActionManager.add("group", FileUtils.defaultThemeManager.getImageIcon("group"), "Group selected structures", -1, "", this); theActionManager.add("placestructures", FileUtils.defaultThemeManager.getImageIcon("placestructures"), "Automatic place all structures", -1, "", this); // view theActionManager.add("zoomnone", FileUtils.defaultThemeManager.getImageIcon("zoomnone"), "Reset zoom", -1, "", this); theActionManager.add("zoomin", FileUtils.defaultThemeManager.getImageIcon("zoomin"), "Zoom in", -1, "", this); theActionManager.add("zoomout", FileUtils.defaultThemeManager.getImageIcon("zoomout"), "Zoom out", -1, "", this); theActionManager.add("notation=" + GraphicOptions.NOTATION_CFG, ThemeManager.getResizableEmptyIcon(ICON_SIZE.L3), "CFG notation", KeyEvent.VK_C, "", this); theActionManager.add("notation=" + GraphicOptions.NOTATION_CFGBW, ThemeManager.getResizableEmptyIcon(ICON_SIZE.L3), "CFG black and white notation", KeyEvent.VK_B, "", this); theActionManager.add("notation=" + GraphicOptions.NOTATION_CFGLINK, ThemeManager.getResizableEmptyIcon(ICON_SIZE.L3), "CFG with linkage placement notation", KeyEvent.VK_L, "", this); theActionManager.add("notation=" + GraphicOptions.NOTATION_UOXF, ThemeManager.getResizableEmptyIcon(ICON_SIZE.L3), "UOXF notation", KeyEvent.VK_O, "", this); theActionManager.add("notation=" + GraphicOptions.NOTATION_TEXT, ThemeManager.getResizableEmptyIcon(ICON_SIZE.L3), "Text only notation", KeyEvent.VK_T, "", this); theActionManager.add("display=" + GraphicOptions.DISPLAY_COMPACT, ThemeManager.getResizableEmptyIcon(ICON_SIZE.L3), "compact view", KeyEvent.VK_O, "", this); theActionManager.add("display=" + GraphicOptions.DISPLAY_NORMAL, ThemeManager.getResizableEmptyIcon(ICON_SIZE.L3), "normal view", KeyEvent.VK_N, "", this); theActionManager.add("display=" + GraphicOptions.DISPLAY_NORMALINFO, ThemeManager.getResizableEmptyIcon(ICON_SIZE.L3), "normal view with linkage info", KeyEvent.VK_I, "", this); theActionManager.add("display=" + GraphicOptions.DISPLAY_CUSTOM, ThemeManager.getResizableEmptyIcon(ICON_SIZE.L3), "custom view with user settings", KeyEvent.VK_K, "", this); theActionManager.add("orientation", getOrientationIcon(), "Change orientation", -1, "", this); theActionManager.add("displaysettings", ThemeManager.getEmptyIcon(ICON_SIZE.TINY), "Change structure display settings", KeyEvent.VK_S, "", this); theActionManager.add("reportsettings", ThemeManager.getEmptyIcon(ICON_SIZE.TINY), "Change report display settings", KeyEvent.VK_R, "", this); }
From source file:org.tinymediamanager.ui.MainWindow.java
/** * Create the application./*from w w w .j av a 2 s .c o m*/ * * @param name * the name */ public MainWindow(String name) { super(name); setName("mainWindow"); setMinimumSize(new Dimension(1000, 700)); instance = this; JMenuBar menuBar = new JMenuBar(); setJMenuBar(menuBar); JMenu mnTmm = new JMenu("tinyMediaManager"); mnTmm.setMnemonic(KeyEvent.VK_T); menuBar.add(mnTmm); if (!Globals.isDonator()) { mnTmm.add(new RegisterDonatorVersionAction()); } mnTmm.add(new SettingsAction()); mnTmm.addSeparator(); mnTmm.add(new LaunchUpdaterAction()); mnTmm.addSeparator(); mnTmm.add(new ExitAction()); initialize(); // tools menu JMenu tools = new JMenu(BUNDLE.getString("tmm.tools")); //$NON-NLS-1$ tools.setMnemonic(KeyEvent.VK_O); tools.add(new ClearDatabaseAction()); JMenu cache = new JMenu(BUNDLE.getString("tmm.cache")); //$NON-NLS-1$ cache.setMnemonic(KeyEvent.VK_C); tools.add(cache); JMenuItem clearImageCache = new JMenuItem(new ClearImageCacheAction()); clearImageCache.setMnemonic(KeyEvent.VK_I); cache.add(clearImageCache); JMenuItem rebuildImageCache = new JMenuItem(new RebuildImageCacheAction()); rebuildImageCache.setMnemonic(KeyEvent.VK_R); cache.add(rebuildImageCache); JMenuItem tmmFolder = new JMenuItem(BUNDLE.getString("tmm.gotoinstalldir")); //$NON-NLS-1$ tmmFolder.setMnemonic(KeyEvent.VK_I); tools.add(tmmFolder); tmmFolder.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { Path path = Paths.get(System.getProperty("user.dir")); try { // check whether this location exists if (Files.exists(path)) { TmmUIHelper.openFile(path); } } catch (Exception ex) { LOGGER.error("open filemanager", ex); MessageManager.instance.pushMessage(new Message(MessageLevel.ERROR, path, "message.erroropenfolder", new String[] { ":", ex.getLocalizedMessage() })); } } }); JMenuItem tmmLogs = new JMenuItem(BUNDLE.getString("tmm.errorlogs")); //$NON-NLS-1$ tmmLogs.setMnemonic(KeyEvent.VK_L); tools.add(tmmLogs); tmmLogs.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { JDialog logDialog = new LogDialog(); logDialog.setLocationRelativeTo(MainWindow.getActiveInstance()); logDialog.setVisible(true); } }); JMenuItem tmmMessages = new JMenuItem(BUNDLE.getString("tmm.messages")); //$NON-NLS-1$ tmmMessages.setMnemonic(KeyEvent.VK_L); tools.add(tmmMessages); tmmMessages.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { JDialog messageDialog = MessageHistoryDialog.getInstance(); messageDialog.setVisible(true); } }); tools.addSeparator(); final JMenu menuWakeOnLan = new JMenu(BUNDLE.getString("tmm.wakeonlan")); //$NON-NLS-1$ menuWakeOnLan.setMnemonic(KeyEvent.VK_W); menuWakeOnLan.addMenuListener(new MenuListener() { @Override public void menuCanceled(MenuEvent arg0) { } @Override public void menuDeselected(MenuEvent arg0) { } @Override public void menuSelected(MenuEvent arg0) { menuWakeOnLan.removeAll(); for (final WolDevice device : Globals.settings.getWolDevices()) { JMenuItem item = new JMenuItem(device.getName()); item.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { Utils.sendWakeOnLanPacket(device.getMacAddress()); } }); menuWakeOnLan.add(item); } } }); tools.add(menuWakeOnLan); // activate/deactivate WakeOnLan menu item tools.addMenuListener(new MenuListener() { @Override public void menuSelected(MenuEvent e) { if (Globals.settings.getWolDevices().size() > 0) { menuWakeOnLan.setEnabled(true); } else { menuWakeOnLan.setEnabled(false); } } @Override public void menuDeselected(MenuEvent e) { } @Override public void menuCanceled(MenuEvent e) { } }); if (Globals.isDebug()) { final JMenu debugMenu = new JMenu("Debug"); //$NON-NLS-1$ JMenuItem trace = new JMenuItem("set Logger to TRACE"); //$NON-NLS-1$ trace.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { LoggerContext lc = (LoggerContext) LoggerFactory.getILoggerFactory(); lc.getLogger("org.tinymediamanager").setLevel(Level.TRACE); MessageManager.instance.pushMessage(new Message("Trace levels set!", "")); LOGGER.trace("if you see that, we're now on TRACE logging level ;)"); } }); debugMenu.add(trace); tools.add(debugMenu); } menuBar.add(tools); mnTmm = new JMenu(BUNDLE.getString("tmm.contact")); //$NON-NLS-1$ mnTmm.setMnemonic(KeyEvent.VK_C); mnTmm.add(new FeedbackAction()).setMnemonic(KeyEvent.VK_F); mnTmm.add(new BugReportAction()).setMnemonic(KeyEvent.VK_B); menuBar.add(mnTmm); mnTmm = new JMenu(BUNDLE.getString("tmm.help")); //$NON-NLS-1$ mnTmm.setMnemonic(KeyEvent.VK_H); menuBar.add(mnTmm); mnTmm.add(new WikiAction()).setMnemonic(KeyEvent.VK_W); mnTmm.add(new FaqAction()).setMnemonic(KeyEvent.VK_F); mnTmm.add(new ForumAction()).setMnemonic(KeyEvent.VK_O); mnTmm.addSeparator(); mnTmm.add(new AboutAction()).setMnemonic(KeyEvent.VK_A); menuBar.add(Box.createGlue()); if (!Globals.isDonator()) { JButton btnDonate = new JButton(new DonateAction()); btnDonate.setBorderPainted(false); btnDonate.setFocusPainted(false); btnDonate.setContentAreaFilled(false); menuBar.add(btnDonate); } checkForUpdate(); }
From source file:org.photovault.swingui.PhotoViewController.java
/** Creates a new instance of PhotoViewController */ public PhotoViewController(Container view, AbstractController parentController) { super(view, parentController); photoDAO = getDAOFactory().getPhotoInfoDAO(); folderDAO = getDAOFactory().getPhotoFolderDAO(); ImageIcon rotateCWIcon = getIcon("rotate_cw.png"); ImageIcon rotateCCWIcon = getIcon("rotate_ccw.png"); ImageIcon rotate180DegIcon = getIcon("rotate_180.png"); registerAction("rotate_cw", new RotateSelectedPhotoAction(this, 90, "Rotate CW", rotateCWIcon, "Rotates the selected photo 90 degrees clockwise", KeyEvent.VK_R)); registerAction("rotate_ccw", new RotateSelectedPhotoAction(this, 270, "Rotate CCW", rotateCCWIcon, "Rotates the selected photo 90 degrees counterclockwise", KeyEvent.VK_L)); registerAction("rotate_180", new RotateSelectedPhotoAction(this, 180, "Rotate 180 degrees", rotate180DegIcon, "Rotates the selected photo 180 degrees counterclockwise", KeyEvent.VK_T)); registerAction("rotate_180", new RotateSelectedPhotoAction(this, 180, "Rotate 180 degrees", rotate180DegIcon, "Rotates the selected photo 180 degrees counterclockwise", KeyEvent.VK_T)); String qualityStrings[] = { "Unevaluated", "Top", "Good", "OK", "Poor", "Unusable" }; String qualityIconnames[] = { "quality_unevaluated.png", "quality_top.png", "quality_good.png", "quality_ok.png", "quality_poor.png", "quality_unusable.png" }; KeyStroke qualityAccelerators[] = { null, KeyStroke.getKeyStroke(KeyEvent.VK_5, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()), KeyStroke.getKeyStroke(KeyEvent.VK_4, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()), KeyStroke.getKeyStroke(KeyEvent.VK_3, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()), KeyStroke.getKeyStroke(KeyEvent.VK_2, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()), KeyStroke.getKeyStroke(KeyEvent.VK_1, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()), }; ImageIcon[] qualityIcons = new ImageIcon[qualityStrings.length]; for (int n = 0; n < qualityStrings.length; n++) { qualityIcons[n] = getIcon(qualityIconnames[n]); DataAccessAction qualityAction = new SetPhotoQualityAction(this, n, qualityStrings[n], qualityIcons[n], "Set quality of selected phots to \"" + qualityStrings[n] + "\"", null); qualityAction.putValue(AbstractAction.ACCELERATOR_KEY, qualityAccelerators[n]); registerAction("quality_" + n, qualityAction); registerEventListener(TaskFinishedEvent.class, new DefaultEventListener<BackgroundTask>() { public void handleEvent(DefaultEvent<BackgroundTask> event) { BackgroundTask task = event.getPayload(); if (task instanceof IndexFileTask) { IndexFileTask ifTask = (IndexFileTask) task; if (ifTask.getResult() == IndexingResult.ERROR || ifTask.getResult() == IndexingResult.NOT_IMAGE) { return; }/*from ww w . ja v a2s . c om*/ UUID volId = ifTask.getVolume().getId(); FileLocation loc = ifTask.getFileLocation(); Set<PhotoInfo> photos = ifTask.getPhotosFound(); log.debug("Found file " + loc.getFile() + " in volume " + volId); for (PhotoInfo p : photos) { log.debug(" linked to photo " + p.getUuid()); } if (collection instanceof ExtDirPhotos) { ExtDirPhotos dir = (ExtDirPhotos) collection; if (loc.getVolume().getId().equals(dir.getVolId()) && loc.getDirName().equals(dir.getDirPath())) { addPhotos(photos); updateThumbView(); } } } } }); } // Create the UI controls thumbPane = new PhotoCollectionThumbView(this, null); thumbPane.addSelectionChangeListener(new SelectionChangeListener() { public void selectionChanged(SelectionChangeEvent e) { thumbSelectionChanged(e); } }); previewPane = new JAIPhotoViewer(this); previewPane.getActionMap().put("hide_fullwindow_preview", new HidePhotoPreviewAction(this)); previewPane.getActionMap().put("move_next", thumbPane.getSelectNextAction()); previewPane.getActionMap().put("move_prev", thumbPane.getSelectPreviousAction()); // Create the split pane to display both of these components thumbScroll = new JScrollPane(thumbPane); thumbPane.setBackground(Color.WHITE); thumbScroll.getViewport().setBackground(Color.WHITE); thumbScroll.addComponentListener(new ComponentAdapter() { @Override public void componentResized(ComponentEvent e) { handleThumbAreaResize(); } }); scrollLayer = new JXLayer<JScrollPane>(thumbScroll); progressLayer = new ProgressIndicatorLayer(); scrollLayer.setUI(progressLayer); collectionPane = new JPanel(); splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT); layeredPane = new JLayeredPane(); layeredPane.setLayout(new StackLayout()); collectionPane.add(splitPane); collectionPane.add(layeredPane); GridBagLayout layout = new GridBagLayout(); collectionPane.setLayout(layout); GridBagConstraints c = new GridBagConstraints(); c.fill = GridBagConstraints.BOTH; c.weighty = 1.0; c.weightx = 1.0; c.gridy = 0; // collectionPane.add( scrollLayer ); layout.setConstraints(splitPane, c); layout.setConstraints(layeredPane, c); // collectionPane.add( previewPane ); thumbPane.setRowHeight(200); setLayout(Layout.ONLY_THUMBS); /* Register action so that we are notified of changes to currently displayed folder */ registerEventListener(CommandExecutedEvent.class, new DefaultEventListener<DataAccessCommand>() { public void handleEvent(DefaultEvent<DataAccessCommand> event) { DataAccessCommand cmd = event.getPayload(); if (cmd instanceof ChangePhotoInfoCommand) { photoChangeCommandExecuted((ChangePhotoInfoCommand) cmd); } else if (cmd instanceof CreateCopyImageCommand) { imageCreated((CreateCopyImageCommand) cmd); } else if (cmd instanceof ApplyChangeCommand) { changeApplied((ApplyChangeCommand) cmd); } } }); }
From source file:ListCutPaste.java
/** * Create an Edit menu to support cut/copy/paste. *//*w ww . j a v a2 s. c om*/ public JMenuBar createMenuBar() { JMenuItem menuItem = null; JMenuBar menuBar = new JMenuBar(); JMenu mainMenu = new JMenu("Edit"); mainMenu.setMnemonic(KeyEvent.VK_E); TransferActionListener actionListener = new TransferActionListener(); menuItem = new JMenuItem("Cut"); menuItem.setActionCommand((String) TransferHandler.getCutAction().getValue(Action.NAME)); menuItem.addActionListener(actionListener); menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_X, ActionEvent.CTRL_MASK)); menuItem.setMnemonic(KeyEvent.VK_T); mainMenu.add(menuItem); menuItem = new JMenuItem("Copy"); menuItem.setActionCommand((String) TransferHandler.getCopyAction().getValue(Action.NAME)); menuItem.addActionListener(actionListener); menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_C, ActionEvent.CTRL_MASK)); menuItem.setMnemonic(KeyEvent.VK_C); mainMenu.add(menuItem); menuItem = new JMenuItem("Paste"); menuItem.setActionCommand((String) TransferHandler.getPasteAction().getValue(Action.NAME)); menuItem.addActionListener(actionListener); menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_V, ActionEvent.CTRL_MASK)); menuItem.setMnemonic(KeyEvent.VK_P); mainMenu.add(menuItem); menuBar.add(mainMenu); return menuBar; }
From source file:DragPictureDemo2.java
public JMenuBar createMenuBar() { JMenuItem menuItem = null;//w w w . j a va 2 s .c o m JMenuBar menuBar = new JMenuBar(); JMenu mainMenu = new JMenu("Edit"); mainMenu.setMnemonic(KeyEvent.VK_E); TransferActionListener actionListener = new TransferActionListener(); menuItem = new JMenuItem("Cut"); menuItem.setActionCommand((String) TransferHandler.getCutAction().getValue(Action.NAME)); menuItem.addActionListener(actionListener); menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_X, ActionEvent.CTRL_MASK)); menuItem.setMnemonic(KeyEvent.VK_T); mainMenu.add(menuItem); menuItem = new JMenuItem("Copy"); menuItem.setActionCommand((String) TransferHandler.getCopyAction().getValue(Action.NAME)); menuItem.addActionListener(actionListener); menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_C, ActionEvent.CTRL_MASK)); menuItem.setMnemonic(KeyEvent.VK_C); mainMenu.add(menuItem); menuItem = new JMenuItem("Paste"); menuItem.setActionCommand((String) TransferHandler.getPasteAction().getValue(Action.NAME)); menuItem.addActionListener(actionListener); menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_V, ActionEvent.CTRL_MASK)); menuItem.setMnemonic(KeyEvent.VK_P); mainMenu.add(menuItem); menuBar.add(mainMenu); return menuBar; }
From source file:org.apache.cayenne.modeler.CayenneModelerFrame.java
protected void initMenus() { getContentPane().setLayout(new BorderLayout()); JMenu fileMenu = new JMenu("File"); JMenu editMenu = new JMenu("Edit"); JMenu projectMenu = new JMenu("Project"); JMenu toolMenu = new JMenu("Tools"); JMenu helpMenu = new JMenu("Help"); fileMenu.setMnemonic(KeyEvent.VK_F); editMenu.setMnemonic(KeyEvent.VK_E); projectMenu.setMnemonic(KeyEvent.VK_P); toolMenu.setMnemonic(KeyEvent.VK_T); helpMenu.setMnemonic(KeyEvent.VK_H); fileMenu.add(getAction(NewProjectAction.class).buildMenu()); fileMenu.add(getAction(OpenProjectAction.class).buildMenu()); fileMenu.add(getAction(ProjectAction.class).buildMenu()); fileMenu.add(getAction(ImportDataMapAction.class).buildMenu()); fileMenu.addSeparator();/*from w ww . j av a 2 s . c o m*/ fileMenu.add(getAction(SaveAction.class).buildMenu()); fileMenu.add(getAction(SaveAsAction.class).buildMenu()); fileMenu.add(getAction(RevertAction.class).buildMenu()); fileMenu.addSeparator(); editMenu.add(getAction(UndoAction.class).buildMenu()); editMenu.add(getAction(RedoAction.class).buildMenu()); editMenu.add(getAction(CutAction.class).buildMenu()); editMenu.add(getAction(CopyAction.class).buildMenu()); editMenu.add(getAction(PasteAction.class).buildMenu()); recentFileMenu = new RecentFileMenu("Recent Projects"); addRecentFileListListener(recentFileMenu); fileMenu.add(recentFileMenu); fileMenu.addSeparator(); fileMenu.add(getAction(ExitAction.class).buildMenu()); projectMenu.add(getAction(ValidateAction.class).buildMenu()); projectMenu.addSeparator(); projectMenu.add(getAction(CreateNodeAction.class).buildMenu()); projectMenu.add(getAction(CreateDataMapAction.class).buildMenu()); projectMenu.add(getAction(CreateObjEntityAction.class).buildMenu()); projectMenu.add(getAction(CreateEmbeddableAction.class).buildMenu()); projectMenu.add(getAction(CreateDbEntityAction.class).buildMenu()); projectMenu.add(getAction(CreateProcedureAction.class).buildMenu()); projectMenu.add(getAction(CreateQueryAction.class).buildMenu()); projectMenu.addSeparator(); projectMenu.add(getAction(ObjEntitySyncAction.class).buildMenu()); projectMenu.addSeparator(); projectMenu.add(getAction(RemoveAction.class).buildMenu()); toolMenu.add(getAction(ReverseEngineeringAction.class).buildMenu()); toolMenu.add(getAction(InferRelationshipsAction.class).buildMenu()); toolMenu.add(getAction(ImportEOModelAction.class).buildMenu()); toolMenu.addSeparator(); toolMenu.add(getAction(GenerateCodeAction.class).buildMenu()); toolMenu.add(getAction(GenerateDBAction.class).buildMenu()); toolMenu.add(getAction(MigrateAction.class).buildMenu()); /** * Menu for opening Log console */ toolMenu.addSeparator(); logMenu = getAction(ShowLogConsoleAction.class).buildCheckBoxMenu(); if (!LogConsole.getInstance().getConsoleProperty(LogConsole.DOCKED_PROPERTY) && LogConsole.getInstance().getConsoleProperty(LogConsole.SHOW_CONSOLE_PROPERTY)) { LogConsole.getInstance().setConsoleProperty(LogConsole.SHOW_CONSOLE_PROPERTY, false); } updateLogConsoleMenu(); toolMenu.add(logMenu); toolMenu.addSeparator(); toolMenu.add(getAction(ConfigurePreferencesAction.class).buildMenu()); helpMenu.add(getAction(AboutAction.class).buildMenu()); helpMenu.add(getAction(DocumentationAction.class).buildMenu()); JMenuBar menuBar = new JMenuBar(); menuBar.add(fileMenu); menuBar.add(editMenu); menuBar.add(projectMenu); menuBar.add(toolMenu); menuBar.add(helpMenu); setJMenuBar(menuBar); }
From source file:com.netease.dagger.BrowserEmulator.java
/** * Open new tab in browser/*from w w w . j ava2 s . c om*/ */ public void openNewTAB() { pause(stepInterval); try { Robot robot = new Robot(); robot.keyPress(KeyEvent.VK_CONTROL); robot.keyPress(KeyEvent.VK_T); robot.keyRelease(KeyEvent.VK_CONTROL); robot.keyRelease(KeyEvent.VK_T); } catch (Exception e) { e.printStackTrace(); handleFailure("Failed to open new TAB"); } logger.info("Success to open new TAB"); }
From source file:org.rimudb.editor.RimuDBEditor.java
public JMenuBar buildJMenuBar() { log.debug("buildJMenuBar()"); JMenuBar menuBar = new JMenuBar(); // File menu/* ww w.j a va2 s. c om*/ JMenu menu = new JMenu("File"); menu.setMnemonic(KeyEvent.VK_F); openMenuItem = new JMenuItem( new OpenDescriptorAction(this, "Open...", loadIcon("/images/famfamfam/folder.png"))); openMenuItem.setName("OpenMenuItem"); openMenuItem.setMnemonic(KeyEvent.VK_O); openMenuItem.setAccelerator( KeyStroke.getKeyStroke('O', Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), false)); menu.add(openMenuItem); saveMenuItem = new JMenuItem( new SaveDescriptorAction(this, "Save", loadIcon("/images/famfamfam/disk.png"))); saveMenuItem.setName("SaveMenuItem"); saveMenuItem.setMnemonic(KeyEvent.VK_S); saveMenuItem.setAccelerator( KeyStroke.getKeyStroke('S', Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), false)); menu.add(saveMenuItem); saveAsMenuItem = new JMenuItem(new SaveAsDescriptorAction(this, "Save as...")); saveAsMenuItem.setName("SaveAsMenuItem"); menu.add(saveAsMenuItem); menu.addSeparator(); clearMenuItem = new JMenuItem( new ClearTableAction(this, "Clear...", loadIcon("/images/famfamfam/bin_closed.png"))); clearMenuItem.setName("ClearMenuItem"); clearMenuItem.setMnemonic(KeyEvent.VK_C); menu.add(clearMenuItem); preferencesMenuItem = new JMenuItem( new PreferencesAction(this, "Preferences...", loadIcon("/images/famfamfam/text_list_bullets.png"))); preferencesMenuItem.setName("PreferencesMenuItem"); preferencesMenuItem.setEnabled(false); preferencesMenuItem.setMnemonic(KeyEvent.VK_P); menu.add(preferencesMenuItem); menu.addSeparator(); exitMenuItem = new JMenuItem(new ExitAction(this, "Exit")); exitMenuItem.setName("ExitMenuItem"); exitMenuItem.setMnemonic(KeyEvent.VK_E); menu.add(exitMenuItem); menuBar.add(menu); JMenu toolsMenu = new JMenu("Tools"); toolsMenu.setMnemonic(KeyEvent.VK_T); dbImportMenuItem = new JMenuItem( new ImportAction(this, "Import from database...", loadIcon("/images/famfamfam/database_go.png"))); dbImportMenuItem.setName("DbImportMenuItem"); dbImportMenuItem.setEnabled(false); dbImportMenuItem.setMnemonic(KeyEvent.VK_I); dbImportMenuItem.setAccelerator( KeyStroke.getKeyStroke('I', Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), false)); toolsMenu.add(dbImportMenuItem); createClassesMenuItem = new JMenuItem(new GenerateJavaAction(this, "Create classes...", loadIcon("/images/famfamfam/page_white_cup.png"))); createClassesMenuItem.setName("CreateClassesMenuItem"); createClassesMenuItem.setMnemonic(KeyEvent.VK_C); toolsMenu.add(createClassesMenuItem); ddsExportMenuItem = new JMenuItem("Export as DDS..."); ddsExportMenuItem.setName("DdsExportMenuItem"); ddsExportMenuItem.setMnemonic(KeyEvent.VK_D); ddsExportMenuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { actionExportToDDS(); } }); toolsMenu.add(ddsExportMenuItem); sqlExportMenuItem = new JMenuItem("Export as SQL..."); sqlExportMenuItem.setIcon(loadIcon("/images/famfamfam/page_white_database.png")); sqlExportMenuItem.setName("SqlExportMenuItem"); sqlExportMenuItem.setMnemonic(KeyEvent.VK_Q); sqlExportMenuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { actionExportToSQL(); } }); toolsMenu.add(sqlExportMenuItem); toolsMenu.addSeparator(); propertyRenameMenuItem = new JMenuItem("Rename Properties..."); propertyRenameMenuItem.setName("PropertyRenameMenuItem"); propertyRenameMenuItem.setMnemonic(KeyEvent.VK_R); propertyRenameMenuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { actionRenameProperties(); } }); toolsMenu.add(propertyRenameMenuItem); copyCodeMenuItem = new JMenuItem(new GenerateCopyCodeAction(this, "Create Java DO Copy Code...", null)); copyCodeMenuItem.setName("CopyCodeMenuItem"); toolsMenu.add(copyCodeMenuItem); convertFinderMenuItem = new JMenuItem(new ConvertFinderAction(this, "Convert Finders (pre 1.1)...", null)); convertFinderMenuItem.setName("ConvertFinderMenuItem"); toolsMenu.add(convertFinderMenuItem); convertCDBMenuItem = new JMenuItem(new ConvertCDBAction(this, "Convert CDB Configs (pre 1.2)...", null)); convertCDBMenuItem.setName("ConvertCDBMenuItem"); toolsMenu.add(convertCDBMenuItem); menuBar.add(toolsMenu); JMenu helpMenu = new JMenu("Help"); helpMenu.setMnemonic(KeyEvent.VK_H); aboutMenuItem = new JMenuItem(new AboutAction(this, "About...")); aboutMenuItem.setName("AboutMenuItem"); helpMenu.add(aboutMenuItem); menuBar.add(helpMenu); return menuBar; }