List of usage examples for java.awt.event KeyEvent VK_S
int VK_S
To view the source code for java.awt.event KeyEvent VK_S.
Click Source Link
From source file:uk.nhs.cfh.dsp.srth.query.repository.viewcomponent.actions.SaveQueryToRepositoryAction.java
/** * Instantiates a new save query to repository action. * * @param applicationService the application service * @param queryService the query service * @param queryRepositoryService the query repository service *//*w ww. ja v a 2s. c om*/ public SaveQueryToRepositoryAction(ApplicationService applicationService, QueryService queryService, QueryRepositoryService queryRepositoryService) { super("Save query to repository", new ImageIcon(SaveQueryToRepositoryAction.class.getResource("resources/savetorepo.png"))); this.applicationService = applicationService; this.queryService = queryService; this.queryRepositoryService = queryRepositoryService; putValue(ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_S, (java.awt.event.InputEvent.ALT_MASK | (Toolkit.getDefaultToolkit().getMenuShortcutKeyMask())))); putValue(SHORT_DESCRIPTION, "Save query to repository"); putValue(LONG_DESCRIPTION, "Saves the query to the query repository"); }
From source file:org.pmedv.blackboard.commands.ConvertToSymbolCommand.java
public ConvertToSymbolCommand() { putValue(Action.NAME, resources.getResourceByKey("ConvertToSymbolCommand.name")); putValue(Action.SMALL_ICON, resources.getIcon("icon.converttosymbol")); putValue(Action.SHORT_DESCRIPTION, resources.getResourceByKey("ConvertToSymbolCommand.description")); putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_S, InputEvent.ALT_DOWN_MASK | InputEvent.SHIFT_DOWN_MASK)); setEnabled(false);/*from w ww . j a v a 2s .c o m*/ }
From source file:com.github.pemapmodder.pocketminegui.gui.server.ServerMainActivity.java
@Override protected void onStart() { lifetime = new ServerLifetime(this); // setLayout(new BoxLayout(getContentPane(), BoxLayout.Y_AXIS)); setLayout(new GridBagLayout()); JMenuBar bar = new JMenuBar(); JMenu serverMenu = new JMenu("Server"); serverMenu.setMnemonic(KeyEvent.VK_S); JMenu playerMenu = new JMenu("Players"); playerMenu.setMnemonic(KeyEvent.VK_P); bar.add(serverMenu);// ww w . j av a 2 s .com bar.add(playerMenu); setJMenuBar(bar); startStopButton = new JButton("Start"); startStopButton.addActionListener(lifetime::listen); GridBagConstraints constr = new GridBagConstraints(); constr.gridx = 0; constr.gridy = 0; constr.fill = GridBagConstraints.VERTICAL; constr.weighty = 0.02; constr.weightx = 0.1; add(startStopButton, constr); constr.gridx = 1; constr.gridy = 1; constr.fill = GridBagConstraints.BOTH; constr.weightx = 0.8; constr.weighty = 0.9; add(consolePanel = new ConsolePanel(this), constr); }
From source file:org.photovault.swingui.ExportSelectedAction.java
/** Constructor.// www . java2 s .co m @param view The view this action object is associated with. The action gets the selection to export from this view. */ public ExportSelectedAction(PhotoCollectionThumbView view, String text, ImageIcon icon, String desc, int mnemonic) { super(text, icon); this.view = view; putValue(SHORT_DESCRIPTION, desc); putValue(MNEMONIC_KEY, new Integer(mnemonic)); putValue(ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_S, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask())); view.addSelectionChangeListener(this); setEnabled(view.getSelectedCount() > 0); }
From source file:net.openbyte.gui.WorkFrame.java
public WorkFrame(ModificationAPI api, File workDirectory) { this.workDirectory = workDirectory; this.api = api; try {// w w w . j ava 2 s. c om format = LibrarySerializer.deserialize(new File(workDirectory, "libraries.json")); } catch (Exception e) { e.printStackTrace(); } initComponents(); KeyStroke keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_S, KeyEvent.CTRL_DOWN_MASK); menuItem4.setAccelerator(keyStroke); tree1.setModel(new FileSystemModel(this.workDirectory)); JavaLanguageSupport support = new JavaLanguageSupport(); try { support.getJarManager().addCurrentJreClassFileSource(); } catch (IOException e) { e.printStackTrace(); } try { for (LibraryEntry entry : format.libraries) { File entryJar = new File(entry.path); support.getJarManager().addClassFileSource(entryJar); } } catch (Exception e) { e.printStackTrace(); } if (api == ModificationAPI.BUKKIT) { try { support.getJarManager().addClassFileSource(new File(new File(workDirectory, "api"), "bukkit.jar")); } catch (IOException e) { e.printStackTrace(); } } support.setAutoActivationDelay(0); support.setAutoCompleteEnabled(true); support.setParameterAssistanceEnabled(true); support.install(rSyntaxTextArea1); //PrintStream out = System.out; //System.setOut(new PrintStream(new StreamCapturer("OpenByte", this, out))); }
From source file:com.evanbelcher.DrillBook.display.DBMenuBar.java
/** * Constructs DBMenuBar. Adds the menu and menuitems. * * @param graphicsRunner the JFrame that created this * @param desktop the DBDesktopPane in the JFrame *//*from www . j av a2s.co m*/ public DBMenuBar(GraphicsRunner graphicsRunner, DBDesktopPane desktop) { super(); gr = graphicsRunner; this.desktop = desktop; //Set up the menu JMenu menu = new JMenu("File"); add(menu); //Set up the menu items. JMenuItem menuItem = new JMenuItem("New"); menuItem.setMnemonic(KeyEvent.VK_N); menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_N, InputEvent.CTRL_DOWN_MASK)); menuItem.setActionCommand("new"); menuItem.addActionListener(this); menu.add(menuItem); menuItem = new JMenuItem("Open"); menuItem.setMnemonic(KeyEvent.VK_O); menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_O, InputEvent.CTRL_DOWN_MASK)); menuItem.setActionCommand("open"); menuItem.addActionListener(this); menuItem.setLayout(new MigLayout()); menu.add(menuItem); menuItem = new JMenuItem("Save"); menuItem.setMnemonic(KeyEvent.VK_S); menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_S, InputEvent.CTRL_DOWN_MASK)); menuItem.setActionCommand("save"); menuItem.addActionListener(this); menu.add(menuItem); menuItem = new JMenuItem("Save As"); menuItem.setActionCommand("saveas"); menuItem.addActionListener(this); menu.add(menuItem); menuItem = new JMenuItem("Print Current Page"); menuItem.setMnemonic(KeyEvent.VK_P); menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_P, InputEvent.CTRL_DOWN_MASK)); menuItem.setActionCommand("printpage"); menuItem.addActionListener(this); menu.add(menuItem); menuItem = new JMenuItem("Print Show"); menuItem.setActionCommand("printshow"); menuItem.addActionListener(this); menu.add(menuItem); menuItem = new JMenuItem("Print Dot Sheets"); menuItem.setActionCommand("printdotsheets"); menuItem.addActionListener(this); menu.add(menuItem); menuItem = new JMenuItem("Quit"); menuItem.setMnemonic(KeyEvent.VK_Q); menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, InputEvent.CTRL_DOWN_MASK)); menuItem.setActionCommand("quit"); menuItem.addActionListener(this); menu.add(menuItem); menu = new JMenu("Edit"); add(menu); menuItem = new JMenuItem("Undo"); menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_Z, InputEvent.CTRL_DOWN_MASK)); menuItem.setActionCommand("undo"); menuItem.addActionListener(this); menu.add(menuItem); menuItem = new JMenuItem("Redo"); menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_Y, InputEvent.CTRL_DOWN_MASK)); menuItem.setActionCommand("redo"); menuItem.addActionListener(this); menu.add(menuItem); menu = new JMenu("Settings"); add(menu); menuItem = new JMenuItem("Toggle Gridlines"); menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_G, InputEvent.CTRL_DOWN_MASK)); menuItem.setActionCommand("togglegrid"); menuItem.addActionListener(this); menuItem.setForeground(Main.getState().getSettings().shouldShowGrid() ? Color.BLACK : Color.RED); menu.add(menuItem); menuItem = new JMenuItem("Toggle Dot Names"); menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_D, InputEvent.CTRL_DOWN_MASK)); menuItem.setActionCommand("togglenames"); menuItem.addActionListener(this); menuItem.setForeground(Main.getState().getSettings().shouldShowNames() ? Color.BLACK : Color.RED); menu.add(menuItem); menuItem = new JMenuItem("Toggle Text Box"); menuItem.setActionCommand("toggletext"); menuItem.addActionListener(this); menuItem.setForeground(Main.getState().getSettings().shouldShowText() ? Color.BLACK : Color.RED); menu.add(menuItem); menuItem = new JMenuItem("Color Code Dots by Instrument"); menuItem.setActionCommand("colordots"); menuItem.addActionListener(this); menuItem.setForeground(Main.getState().getSettings().shouldColorDots() ? Color.BLACK : Color.RED); menu.add(menuItem); menuItem = new JMenuItem(); menuItem.setText(Main.getState().getSettings().useCollegeHashes() ? "Change to High School Hashes" : "Change to College Hashes"); menuItem.setActionCommand("changehash"); menuItem.addActionListener(this); menu.add(menuItem); menuItem = new JMenuItem("Change Font Size"); menuItem.setActionCommand("fontsize"); menuItem.addActionListener(this); menu.add(menuItem); //add(Box.createHorizontalStrut(menu.getPreferredSize().width)); //add these to the menubar itself menuItem = new JMenuItem("Play"); menuItem.setMaximumSize(new Dimension(menuItem.getPreferredSize().width, Integer.MAX_VALUE)); menuItem.setActionCommand("play"); menuItem.addActionListener(this); add(menuItem); add(Box.createHorizontalGlue()); menu = new JMenu("Help"); add(menu); menuItem = new JMenuItem("Help"); menuItem.setActionCommand("help"); menuItem.addActionListener(this); menu.add(menuItem); menuItem = new JMenuItem("About"); menuItem.setActionCommand("about"); menuItem.addActionListener(this); menu.add(menuItem); }
From source file:uk.co.petertribble.jkstat.gui.KstatBaseChartFrame.java
/** * Create the File... Menu./* w w w. ja v a 2 s. co m*/ * * @return the File Menu */ protected JMenu fileMenu() { JMenu jme = new JMenu(KstatResources.getString("FILE.TEXT")); jme.setMnemonic(KeyEvent.VK_F); saveItem = new JMenuItem(KstatResources.getString("FILE.SAVEAS.TEXT"), KeyEvent.VK_S); saveItem.addActionListener(this); jme.add(saveItem); jme.addSeparator(); exitItem = new JMenuItem(KstatResources.getString("FILE.CLOSE.TEXT"), KeyEvent.VK_C); exitItem.addActionListener(this); jme.add(exitItem); return jme; }
From source file:com.mirth.connect.client.ui.components.MirthTable.java
public MirthTable(String prefix, Set<String> defaultVisibleColumns) { super();// w w w . j a v a 2 s. co m this.prefix = prefix; this.defaultVisibleColumns = defaultVisibleColumns; userPreferences = Preferences.userNodeForPackage(Mirth.class); columnOrderMap = new HashMap<String, Integer>(); if (StringUtils.isNotEmpty(prefix)) { try { userPreferences = Preferences.userNodeForPackage(Mirth.class); String columns = userPreferences.get(prefix + "ColumnOrderMap", ""); if (StringUtils.isNotEmpty(columns)) { columnOrderMap = (Map<String, Integer>) ObjectXMLSerializer.getInstance().deserialize(columns, Map.class); } } catch (Exception e) { } sortKeys = new ArrayList<SortKey>(); try { String sortOrder = userPreferences.get(prefix + "SortOrder", ""); if (StringUtils.isNotEmpty(sortOrder)) { sortKeys = ObjectXMLSerializer.getInstance().deserialize(sortOrder, List.class); } } catch (Exception e) { } } setDragEnabled(true); addKeyListener(new KeyListener() { public void keyPressed(KeyEvent e) { boolean isAccelerated = (((e.getModifiers() & Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()) > 0) || ((e.getModifiers() & InputEvent.CTRL_MASK) > 0)); if ((e.getKeyCode() == KeyEvent.VK_S) && isAccelerated) { PlatformUI.MIRTH_FRAME.doContextSensitiveSave(); } } public void keyReleased(KeyEvent e) { } public void keyTyped(KeyEvent e) { } }); /* * Swingx 1.0 has this set to true by default, which doesn't allow dragging and dropping * into tables. Swingx 0.8 had this set to false. Tables that want it set to true can * override it. */ putClientProperty("terminateEditOnFocusLost", Boolean.FALSE); getTableHeader().addMouseListener(new MouseAdapter() { public void mouseReleased(MouseEvent e) { saveColumnOrder(); } }); final JButton columnControlButton = new JButton(new ColumnControlButton(this).getIcon()); columnControlButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { JPopupMenu columnMenu = getColumnMenu(); Dimension buttonSize = columnControlButton.getSize(); int xPos = columnControlButton.getComponentOrientation().isLeftToRight() ? buttonSize.width - columnMenu.getPreferredSize().width : 0; columnMenu.show(columnControlButton, xPos, columnControlButton.getHeight()); } }); setColumnControl(columnControlButton); }
From source file:be.fedict.eid.tsl.tool.TslTool.java
private void initFileMenu(JMenuBar menuBar) { JMenu fileMenu = new JMenu("File"); fileMenu.setMnemonic(KeyEvent.VK_F); menuBar.add(fileMenu);//from w ww .ja v a2 s . co m initNewMenu(fileMenu); addActionMenuItem("Open", KeyEvent.VK_O, OPEN_ACTION_COMMAND, fileMenu); fileMenu.addSeparator(); this.signMenuItem = addActionMenuItem("Sign", KeyEvent.VK_S, SIGN_ACTION_COMMAND, fileMenu, false); this.saveMenuItem = addActionMenuItem("Save", KeyEvent.VK_A, SAVE_ACTION_COMMAND, fileMenu, false); this.saveAsMenuItem = addActionMenuItem("Save As", KeyEvent.VK_V, SAVE_AS_ACTION_COMMAND, fileMenu, false); this.exportMenuItem = addActionMenuItem("Export", KeyEvent.VK_E, EXPORT_ACTION_COMMAND, fileMenu, false); this.closeMenuItem = addActionMenuItem("Close", KeyEvent.VK_C, CLOSE_ACTION_COMMAND, fileMenu, false); fileMenu.addSeparator(); addActionMenuItem("Exit", KeyEvent.VK_X, EXIT_ACTION_COMMAND, fileMenu); }
From source file:net.sf.clichart.main.ChartFrame.java
private void createMenu() { JMenuBar menuBar = new JMenuBar(); setJMenuBar(menuBar);/* w w w. j av a 2s.c om*/ JMenu fileMenu = new JMenu("File"); menuBar.add(fileMenu); JMenuItem saveItem = new JMenuItem("Save as...", KeyEvent.VK_S); saveItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_S, ActionEvent.CTRL_MASK)); saveItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { saveChart(); } }); fileMenu.add(saveItem); JMenuItem exitItem = new JMenuItem("Exit", KeyEvent.VK_Q); exitItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_Q, ActionEvent.CTRL_MASK)); exitItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { System.exit(0); } }); fileMenu.addSeparator(); fileMenu.add(exitItem); }