List of usage examples for java.awt.event KeyEvent VK_V
int VK_V
To view the source code for java.awt.event KeyEvent VK_V.
Click Source Link
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 www .j a va 2 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(); } }; }
From source file:org.sakuli.actions.environment.Environment.java
/** * pastes the current clipboard content into the focused area. Will do the same as "CTRL + C". * * @return this {@link Environment}./* ww w .j av a 2 s .co m*/ */ @ModifySahiTimer @LogToResult(message = "paste the current clipboard into the focus", logClassInstance = false) public Environment pasteClipboard() { int mod = Key.getHotkeyModifier(); IRobot r = loader.getScreen().getRobot(); r.keyDown(mod); r.keyDown(KeyEvent.VK_V); r.keyUp(KeyEvent.VK_V); r.keyUp(mod); return this; }
From source file:org.sikuli.ide.SikuliIDE.java
private void initEditMenu() throws NoSuchMethodException { int scMask = Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(); _editMenu.setMnemonic(java.awt.event.KeyEvent.VK_E); JMenuItem undoItem = _editMenu.add(_undoAction); undoItem.setAccelerator(KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_Z, scMask)); JMenuItem redoItem = _editMenu.add(_redoAction); redoItem.setAccelerator(// ww w . ja v a 2 s .c om KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_Z, scMask | InputEvent.SHIFT_MASK)); _editMenu.addSeparator(); _editMenu.add(createMenuItem(_I("menuEditCut"), KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_X, scMask), new EditAction(EditAction.CUT))); _editMenu.add(createMenuItem(_I("menuEditCopy"), KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_C, scMask), new EditAction(EditAction.COPY))); _editMenu.add(createMenuItem(_I("menuEditPaste"), KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_V, scMask), new EditAction(EditAction.PASTE))); _editMenu.add(createMenuItem(_I("menuEditSelectAll"), KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_A, scMask), new EditAction(EditAction.SELECT_ALL))); if (!Settings.isMac10()) { _editMenu.addSeparator(); JMenu findMenu = new JMenu(_I("menuFind")); _findHelper = new FindAction(); findMenu.setMnemonic(KeyEvent.VK_F); findMenu.add(createMenuItem(_I("menuFindFind"), KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_F, scMask), new FindAction(FindAction.FIND))); findMenu.add(createMenuItem(_I("menuFindFindNext"), KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_G, scMask), new FindAction(FindAction.FIND_NEXT))); findMenu.add(createMenuItem(_I("menuFindFindPrev"), KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_G, scMask | InputEvent.SHIFT_MASK), new FindAction(FindAction.FIND_PREV))); _editMenu.add(findMenu); } _editMenu.addSeparator(); _editMenu.add(createMenuItem(_I("menuEditIndent"), KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_TAB, 0), new EditAction(EditAction.INDENT))); _editMenu.add(createMenuItem(_I("menuEditUnIndent"), KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_TAB, InputEvent.SHIFT_MASK), new EditAction(EditAction.UNINDENT))); }
From source file:org.sikuli.ide.SikuliIDE.java
private void initViewMenu() throws NoSuchMethodException { int scMask = Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(); _viewMenu.setMnemonic(java.awt.event.KeyEvent.VK_V); if (prefs.getPrefMoreCommandBar()) { chkShowCmdList = new JCheckBoxMenuItem(_I("menuViewCommandList"), true); _viewMenu.add(/* www . j ava 2s . co m*/ createMenuItem(chkShowCmdList, KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_L, scMask), new ViewAction(ViewAction.CMD_LIST))); } chkShowThumbs = new JCheckBoxMenuItem(_I("menuViewShowThumbs"), false); _viewMenu.add(createMenuItem(chkShowThumbs, KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_T, scMask), new ViewAction(ViewAction.SHOW_THUMBS))); //TODO Message Area clear //TODO Message Area LineBreak }
From source file:org.tinymediamanager.ui.tvshows.TvShowPanel.java
/** * Builds the menu.// w w w . j a v a2 s.c o m */ private void buildMenu() { menu.setMnemonic(KeyEvent.VK_V); // menu items JMenuItem menuItem = menu.add(actionUpdateDatasources2); menuItem.setMnemonic(KeyEvent.VK_U); menuItem.setAccelerator( KeyStroke.getKeyStroke(KeyEvent.VK_U, ActionEvent.CTRL_MASK + ActionEvent.SHIFT_MASK)); menu.addSeparator(); JMenu menuScrape = new JMenu(BUNDLE.getString("Button.scrape")); //$NON-NLS-1$ menuScrape.setMnemonic(KeyEvent.VK_S); menuItem = menuScrape.add(actionScrape2); menuItem.setMnemonic(KeyEvent.VK_S); menuItem.setAccelerator( KeyStroke.getKeyStroke(KeyEvent.VK_S, ActionEvent.CTRL_MASK + ActionEvent.SHIFT_MASK)); menuItem = menuScrape.add(actionScrapeSelected); menuItem.setMnemonic(KeyEvent.VK_F); menuItem.setAccelerator( KeyStroke.getKeyStroke(KeyEvent.VK_F, ActionEvent.CTRL_MASK + ActionEvent.SHIFT_MASK)); menuItem = menuScrape.add(actionScrapeNewItems); menuItem.setMnemonic(KeyEvent.VK_N); menuItem.setAccelerator( KeyStroke.getKeyStroke(KeyEvent.VK_N, ActionEvent.CTRL_MASK + ActionEvent.SHIFT_MASK)); menu.add(menuScrape); JMenu menuEdit = new JMenu(BUNDLE.getString("Button.edit")); //$NON-NLS-1$ menuEdit.setMnemonic(KeyEvent.VK_E); menuItem = menuEdit.add(actionEdit2); menuItem.setMnemonic(KeyEvent.VK_E); menuItem.setAccelerator( KeyStroke.getKeyStroke(KeyEvent.VK_E, ActionEvent.CTRL_MASK + ActionEvent.SHIFT_MASK)); menuItem = menuEdit.add(actionBatchEdit); menuItem.setMnemonic(KeyEvent.VK_B); menuItem.setAccelerator( KeyStroke.getKeyStroke(KeyEvent.VK_B, ActionEvent.CTRL_MASK + ActionEvent.SHIFT_MASK)); menuItem = menuEdit.add(actionSetWatchedFlag); menuItem.setMnemonic(KeyEvent.VK_W); menuItem.setAccelerator( KeyStroke.getKeyStroke(KeyEvent.VK_W, ActionEvent.CTRL_MASK + ActionEvent.SHIFT_MASK)); menuItem = menuEdit.add(actionChangeSeasonPoster2); menuItem.setMnemonic(KeyEvent.VK_S); menuEdit.add(actionChangeToDvdOrder); menuEdit.add(actionChangeToAiredOrder); menu.add(menuEdit); menu.add(actionRewriteTvShowNfo); menu.add(actionRewriteTvShowEpisodeNfo); menuItem = menu.add(actionRename); menuItem.setMnemonic(KeyEvent.VK_R); menuItem.setAccelerator( KeyStroke.getKeyStroke(KeyEvent.VK_R, ActionEvent.CTRL_MASK + ActionEvent.SHIFT_MASK)); menuItem = menu.add(actionMediaInformation2); menuItem.setMnemonic(KeyEvent.VK_M); menuItem.setAccelerator( KeyStroke.getKeyStroke(KeyEvent.VK_M, ActionEvent.CTRL_MASK + ActionEvent.SHIFT_MASK)); menuItem = menu.add(actionExport); menuItem.setMnemonic(KeyEvent.VK_X); menuItem.setAccelerator( KeyStroke.getKeyStroke(KeyEvent.VK_X, ActionEvent.CTRL_MASK + ActionEvent.SHIFT_MASK)); menuItem = menu.add(actionClearImageCache); menuItem.setMnemonic(KeyEvent.VK_C); menu.addSeparator(); menuItem = menu.add(actionRemove2); menuItem.setAccelerator(KeyStroke.getKeyStroke((char) KeyEvent.VK_DELETE)); menuItem = menu.add(actionDelete2); menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_DELETE, ActionEvent.SHIFT_MASK)); menu.addSeparator(); menuItem = menu.add(actionSyncTrakt); menuItem.setMnemonic(KeyEvent.VK_T); menuItem = menu.add(actionSyncWatchedTrakt); menuItem.setMnemonic(KeyEvent.VK_W); menuItem = menu.add(actionSyncSelectedTrakt); // popup menu JPopupMenu popupMenu = new JPopupMenu(); popupMenu.add(actionScrape2); popupMenu.add(actionScrapeSelected); popupMenu.add(actionScrapeEpisodes); popupMenu.add(actionScrapeEpisodes2); popupMenu.add(actionScrapeNewItems); // popupMenu.add(actionScrapeMetadataSelected); popupMenu.addSeparator(); popupMenu.add(actionUpdateTvShow); popupMenu.addSeparator(); popupMenu.add(actionEdit2); popupMenu.add(actionChangeSeasonPoster2); popupMenu.add(actionBatchEdit); popupMenu.add(actionSetWatchedFlag); popupMenu.add(actionChangeToDvdOrder); popupMenu.add(actionChangeToAiredOrder); popupMenu.add(actionRewriteTvShowNfo); popupMenu.add(actionRewriteTvShowEpisodeNfo); // popupMenu.add(actionBatchEdit); popupMenu.add(actionRename); popupMenu.add(actionMediaInformation2); popupMenu.add(actionExport); popupMenu.add(actionClearImageCache); popupMenu.addSeparator(); popupMenu.add(actionDownloadSubtitles); popupMenu.add(actionSearchAndDownloadSubtitles); popupMenu.addSeparator(); popupMenu.add(actionSyncTrakt); popupMenu.add(actionSyncWatchedTrakt); popupMenu.add(actionSyncSelectedTrakt); popupMenu.addSeparator(); popupMenu.add(actionRemove2); popupMenu.add(actionDelete2); popupMenu.addSeparator(); popupMenu.add(new ExpandAllAction()); popupMenu.add(new CollapseAllAction()); if (Globals.isDebug()) { JMenu menuDebug = new JMenu("Debug"); //$NON-NLS-1$ menuDebug.add(debugDumpShow); popupMenu.addSeparator(); popupMenu.add(menuDebug); } MouseListener popupListener = new TreePopupListener(popupMenu, tree); tree.addMouseListener(popupListener); }
From source file:org.tros.logo.swing.LogoMenuBar.java
/** * Set up the export menu.//from w w w . jav a 2 s .co m * * @return */ private JMenu setupExportMenu() { JMenu exportMenu = new JMenu(Localization.getLocalizedString("ExportMenu")); JMenuItem exportGif = new JMenuItem(Localization.getLocalizedString("ExportGIF")); JMenuItem exportPng = new JMenuItem(Localization.getLocalizedString("ExportPNG")); JMenuItem exportSvg = new JMenuItem(Localization.getLocalizedString("ExportSVG")); exportSvg.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ae) { JFileChooser chooser = new JFileChooser(); chooser.setMultiSelectionEnabled(false); java.util.prefs.Preferences prefs = java.util.prefs.Preferences .userNodeForPackage(LogoMenuBar.class); chooser.setCurrentDirectory(new File(prefs.get("export-directory", "."))); chooser.setVisible(true); int result = chooser.showSaveDialog(parent); if (result == JFileChooser.APPROVE_OPTION) { String filename = chooser.getSelectedFile().getPath(); prefs.put("export-directory", chooser.getSelectedFile().getParent()); if (Drawable.class.isAssignableFrom(canvas.getClass())) { try (FileOutputStream fos = new FileOutputStream(new File(filename))) { generateSVG((Drawable) canvas, fos); fos.flush(); } catch (IOException ex) { org.tros.utils.logging.Logging.getLogFactory().getLogger(LogoMenuBar.class).warn(null, ex); } } } } }); exportGif.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ae) { JFileChooser chooser = new JFileChooser(); chooser.setMultiSelectionEnabled(false); java.util.prefs.Preferences prefs = java.util.prefs.Preferences .userNodeForPackage(LogoMenuBar.class); chooser.setCurrentDirectory(new File(prefs.get("export-directory", "."))); chooser.setVisible(true); int result = chooser.showSaveDialog(parent); if (result == JFileChooser.APPROVE_OPTION) { final String filename = chooser.getSelectedFile().getPath(); prefs.put("export-directory", chooser.getSelectedFile().getParent()); Thread t = new Thread(new Runnable() { @Override public void run() { if (Drawable.class.isAssignableFrom(canvas.getClass()) && BufferedImageProvider.class.isAssignableFrom((canvas.getClass()))) { try { generateGIF(((Drawable) canvas).cloneDrawable(), (BufferedImageProvider) canvas, filename); } catch (SVGGraphics2DIOException ex) { Logger.getLogger(LogoMenuBar.class.getName()).log(Level.SEVERE, null, ex); } catch (IOException ex) { Logger.getLogger(LogoMenuBar.class.getName()).log(Level.SEVERE, null, ex); } } } }); t.setDaemon(true); t.start(); } } }); exportPng.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ae) { JFileChooser chooser = new JFileChooser(); chooser.setMultiSelectionEnabled(false); java.util.prefs.Preferences prefs = java.util.prefs.Preferences .userNodeForPackage(LogoMenuBar.class); chooser.setCurrentDirectory(new File(prefs.get("export-directory", "."))); chooser.setVisible(true); int result = chooser.showSaveDialog(parent); if (result == JFileChooser.APPROVE_OPTION) { String filename = chooser.getSelectedFile().getPath(); prefs.put("export-directory", chooser.getSelectedFile().getParent()); // retrieve image if (BufferedImageProvider.class.isAssignableFrom(canvas.getClass())) { generatePNG((BufferedImageProvider) canvas, filename); } } } }); exportMenu.add(exportSvg); exportMenu.add(exportGif); exportMenu.add(exportPng); exportMenu.setMnemonic('X'); exportSvg.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_V, InputEvent.ALT_MASK)); exportGif.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_G, InputEvent.ALT_MASK)); exportPng.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_P, InputEvent.ALT_MASK)); return (exportMenu); }
From source file:org.vpac.grix.view.swing.Grix.java
/** * This method initializes jMenuItem/* w w w.j a v a2 s . co m*/ * * @return javax.swing.JMenuItem */ private JMenuItem getPasteMenuItem() { if (pasteMenuItem == null) { pasteMenuItem = new JMenuItem(); pasteMenuItem.setText("Paste"); pasteMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_V, Event.CTRL_MASK, true)); } return pasteMenuItem; }
From source file:ru.goodfil.catalog.ui.forms.CarsPanel.java
private void manufactorsListKeyPressed(KeyEvent e) { if (e.getKeyCode() == KeyEvent.VK_INSERT) { createManufactorBtnActionPerformed(null); }/*from w w w . j a v a 2 s. c o m*/ if (e.getKeyCode() == KeyEvent.VK_DELETE) { removeManufactorBtnActionPerformed(null); } if (e.getKeyCode() == KeyEvent.VK_SPACE) { editManufactorBtnActionPerformed(null); } if (e.getKeyCode() == KeyEvent.VK_ENTER) { manufactorsListValueChanged(null); } if ((e.getKeyCode() == KeyEvent.VK_X) && ((e.getModifiers() & KeyEvent.CTRL_MASK) != 0)) { putObjectToMyClipboard(getSelectedManufactors()); this.setOperation(OPERATION_CUT); } if ((e.getKeyCode() == KeyEvent.VK_C) && ((e.getModifiers() & KeyEvent.CTRL_MASK) != 0)) { putObjectToMyClipboard(getSelectedManufactors()); this.setOperation(OPERATION_COPY); } if ((e.getKeyCode() == KeyEvent.VK_V) && ((e.getModifiers() & KeyEvent.CTRL_MASK) != 0)) { List<Manufactor> manufactors = new ArrayList<Manufactor>(); manufactors.addAll(getFromClipboardByType(Manufactor.class)); if (manufactors.size() > 0) { Long vechicleTypeIdNew = getSelectedVechicleTypeId(); Assert.notNull(vechicleTypeIdNew); if (getOperation() == OPERATION_COPY) { carsService.doCopyManufactors(manufactors, vechicleTypeIdNew); } if (getOperation() == OPERATION_CUT) { carsService.doCutManufactors(manufactors, vechicleTypeIdNew); } reReadManufactors(vechicleTypeIdNew); } } }
From source file:ru.goodfil.catalog.ui.forms.CarsPanel.java
private void seriesListKeyPressed(KeyEvent e) { if (e.getKeyCode() == KeyEvent.VK_INSERT) { createSeriaBtnActionPerformed(null); }// ww w . j ava 2 s. c o m if (e.getKeyCode() == KeyEvent.VK_DELETE) { removeSeriaBtnActionPerformed(null); } if (e.getKeyCode() == KeyEvent.VK_SPACE) { editSeriaBtnActionPerformed(null); } if (e.getKeyCode() == KeyEvent.VK_ENTER) { seriesListValueChanged(null); } if ((e.getKeyCode() == KeyEvent.VK_X) && ((e.getModifiers() & KeyEvent.CTRL_MASK) != 0)) { putObjectToMyClipboard(getSelectedSeries()); this.setOperation(OPERATION_CUT); } if ((e.getKeyCode() == KeyEvent.VK_C) && ((e.getModifiers() & KeyEvent.CTRL_MASK) != 0)) { putObjectToMyClipboard(getSelectedSeries()); this.setOperation(OPERATION_COPY); } if ((e.getKeyCode() == KeyEvent.VK_V) && ((e.getModifiers() & KeyEvent.CTRL_MASK) != 0)) { List<Seria> series = new ArrayList<Seria>(); series.addAll(getFromClipboardByType(Seria.class)); if (series.size() > 0) { Long manufactorIdNew = getSelectedManufatorId(); Assert.notNull(manufactorIdNew); if (getOperation() == OPERATION_COPY) { carsService.doCopySeries(series, manufactorIdNew); } if (getOperation() == OPERATION_CUT) { carsService.doCutSeries(series, manufactorIdNew); } reReadSeries(manufactorIdNew); } } }
From source file:ru.goodfil.catalog.ui.forms.CarsPanel.java
private void motorsTableKeyPressed(KeyEvent e) { if (e.getKeyCode() == KeyEvent.VK_INSERT) { createMotorBtnActionPerformed(null); }/*from w w w .ja v a 2s. co m*/ if (e.getKeyCode() == KeyEvent.VK_DELETE) { removeMotorBtnActionPerformed(null); } if (e.getKeyCode() == KeyEvent.VK_SPACE) { editMotorBtnActionPerformed(null); } if ((e.getKeyCode() == KeyEvent.VK_X) && ((e.getModifiers() & KeyEvent.CTRL_MASK) != 0)) { putObjectToMyClipboard(getSelectedMotors()); this.setOperation(OPERATION_CUT); } if ((e.getKeyCode() == KeyEvent.VK_C) && ((e.getModifiers() & KeyEvent.CTRL_MASK) != 0)) { putObjectToMyClipboard(getSelectedMotors()); this.setOperation(OPERATION_COPY); } if ((e.getKeyCode() == KeyEvent.VK_V) && ((e.getModifiers() & KeyEvent.CTRL_MASK) != 0)) { List<Motor> motors = new ArrayList<Motor>(); motors.addAll(getFromClipboardByType(Motor.class)); if (motors.size() > 0) { Long seriaIdNew = getSelectedSeriaId(); Assert.notNull(seriaIdNew); if (getOperation() == OPERATION_COPY) { carsService.doCopyMotors(motors, seriaIdNew); } if (getOperation() == OPERATION_CUT) { carsService.doCutMotors(motors, seriaIdNew); } reReadMotors(seriaIdNew); } } }