List of usage examples for java.awt.event KeyEvent VK_I
int VK_I
To view the source code for java.awt.event KeyEvent VK_I.
Click Source Link
From source file:Main.java
public static void main(String[] argv) throws Exception { JMenuItem item = new JMenuItem("Item"); item.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_I, KeyEvent.SHIFT_MASK)); }
From source file:Main.java
/** * Returns the mnemonic integer.// w w w . j a v a 2s. c o m * * @param c The character (uppercase) * @return The mnemonic. */ @SuppressWarnings("incomplete-switch") private static int setMnemonicsGet(char c) { int mnemonic = 0; switch (Character.toUpperCase(c)) { case '0': mnemonic = KeyEvent.VK_0; break; case '1': mnemonic = KeyEvent.VK_1; break; case '2': mnemonic = KeyEvent.VK_2; break; case '3': mnemonic = KeyEvent.VK_3; break; case '4': mnemonic = KeyEvent.VK_4; break; case '5': mnemonic = KeyEvent.VK_5; break; case '6': mnemonic = KeyEvent.VK_6; break; case '7': mnemonic = KeyEvent.VK_7; break; case '8': mnemonic = KeyEvent.VK_8; break; case '9': mnemonic = KeyEvent.VK_9; break; case 'A': mnemonic = KeyEvent.VK_A; break; case 'B': mnemonic = KeyEvent.VK_B; break; case 'C': mnemonic = KeyEvent.VK_C; break; case 'D': mnemonic = KeyEvent.VK_D; break; case 'E': mnemonic = KeyEvent.VK_E; break; case 'F': mnemonic = KeyEvent.VK_F; break; case 'G': mnemonic = KeyEvent.VK_G; break; case 'H': mnemonic = KeyEvent.VK_H; break; case 'I': mnemonic = KeyEvent.VK_I; break; case 'J': mnemonic = KeyEvent.VK_J; break; case 'K': mnemonic = KeyEvent.VK_K; break; case 'L': mnemonic = KeyEvent.VK_L; break; case 'M': mnemonic = KeyEvent.VK_M; break; case 'N': mnemonic = KeyEvent.VK_N; break; case 'O': mnemonic = KeyEvent.VK_O; break; case 'P': mnemonic = KeyEvent.VK_P; break; case 'Q': mnemonic = KeyEvent.VK_Q; break; case 'R': mnemonic = KeyEvent.VK_R; break; case 'S': mnemonic = KeyEvent.VK_S; break; case 'T': mnemonic = KeyEvent.VK_T; break; case 'U': mnemonic = KeyEvent.VK_U; break; case 'V': mnemonic = KeyEvent.VK_V; break; case 'W': mnemonic = KeyEvent.VK_W; break; case 'X': mnemonic = KeyEvent.VK_X; break; case 'Y': mnemonic = KeyEvent.VK_Y; break; case 'Z': mnemonic = KeyEvent.VK_Z; break; } return mnemonic; }
From source file:onl.area51.gfs.mapviewer.action.ImportGribAction.java
public ImportGribAction() { super("Import Grib File"); setEnabled(enabled);/*from w w w.j a v a 2s .c om*/ putValue(SHORT_DESCRIPTION, "Import Grib File"); putValue(ACCELERATOR_KEY, KeyStroke.getAWTKeyStroke(KeyEvent.VK_I, KeyEvent.CTRL_DOWN_MASK)); fileChooser = new JFileChooser(System.getProperty("user.home")); fileChooser.setMultiSelectionEnabled(false); Grib2FileFilter filter = new Grib2FileFilter(); fileChooser.addChoosableFileFilter(filter); fileChooser.setFileFilter(filter); }
From source file:org.pmedv.blackboard.commands.ExportImageCommand.java
public ExportImageCommand() { putValue(Action.NAME, resources.getResourceByKey("ExportImageCommand.name")); putValue(Action.SMALL_ICON, resources.getIcon("icon.export")); putValue(Action.SHORT_DESCRIPTION, resources.getResourceByKey("ExportImageCommand.description")); putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_I, InputEvent.CTRL_DOWN_MASK)); setEnabled(false);//from w ww . ja va 2s . c o m }
From source file:SynthApplication.java
public Component createComponents() { JButton button = new JButton("I'm a Swing button!"); button.setMnemonic(KeyEvent.VK_I); button.addActionListener(this); label.setLabelFor(button);//from w ww . j a v a2 s.c om /* * An easy way to put space between a top-level container * and its contents is to put the contents in a JPanel * that has an "empty" border. */ JPanel pane = new JPanel(new GridLayout(0, 1)); pane.add(button); pane.add(label); pane.setBorder(BorderFactory.createEmptyBorder(30, //top 30, //left 10, //bottom 30) //right ); return pane; }
From source file:org.zaproxy.zap.extension.importurls.ExtensionImportUrls.java
private ZapMenuItem getMenuImportUrls() { if (menuImportUrls == null) { menuImportUrls = new ZapMenuItem("importurls.topmenu.import.importurls", getView().getMenuShortcutKeyStroke(KeyEvent.VK_I, 0, false)); menuImportUrls//from w w w . j av a2 s. co m .setToolTipText(Constant.messages.getString("importurls.topmenu.import.importurls.tooltip")); menuImportUrls.addActionListener(new java.awt.event.ActionListener() { @Override public void actionPerformed(java.awt.event.ActionEvent e) { // Prompt for a file final JFileChooser chooser = new JFileChooser( Model.getSingleton().getOptionsParam().getUserDirectory()); int rc = chooser.showOpenDialog(View.getSingleton().getMainFrame()); if (rc == JFileChooser.APPROVE_OPTION) { Thread t = new Thread() { @Override public void run() { this.setName(THREAD_PREFIX + threadId++); importUrlFile(chooser.getSelectedFile()); } }; t.start(); } } }); } return menuImportUrls; }
From source file:de.tor.tribes.ui.components.GroupSelectionList.java
public GroupSelectionList(String pResourceURL) { super(pResourceURL); setCellRenderer(renderer);/*from www . j a va2s . co m*/ addKeyListener(new KeyAdapter() { @Override public void keyReleased(KeyEvent e) { if (e.getKeyCode() == KeyEvent.VK_LEFT) { fireDecrementEvent(); } else if (e.getKeyCode() == KeyEvent.VK_RIGHT) { fireIncrementEvent(); } else if (e.getKeyCode() == KeyEvent.VK_DELETE) { fireResetEvent(); } else if (e.getKeyCode() == KeyEvent.VK_O) { fireSetStateEvent(ListItem.RELATION_TYPE.OR); } else if (e.getKeyCode() == KeyEvent.VK_U) { fireSetStateEvent(ListItem.RELATION_TYPE.AND); } else if (e.getKeyCode() == KeyEvent.VK_N) { fireSetStateEvent(ListItem.RELATION_TYPE.NOT); } else if (e.getKeyCode() == KeyEvent.VK_I) { fireSetStateEvent(ListItem.RELATION_TYPE.DISABLED); } else if (e.getKeyCode() == KeyEvent.VK_H) { JOptionPaneHelper.showInformationBox(GroupSelectionList.this, getRelationAsPlainText(), "Information"); } } }); addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { if (e.getClickCount() == 2) { if (e.getButton() == MouseEvent.BUTTON1) { fireClickedEvent(e.getPoint()); } else { fireResetEvent(e.getPoint()); } } } }); TagManager.getSingleton().addManagerListener(GroupSelectionList.this); }
From source file:LookAndFeelDemo.java
public Component createComponents() { JButton button = new JButton("I'm a Swing button!"); button.setMnemonic(KeyEvent.VK_I); button.addActionListener(this); label.setLabelFor(button);/*from w w w . j a va 2s . c om*/ /* * An easy way to put space between a top-level container and its contents * is to put the contents in a JPanel that has an "empty" border. */ JPanel pane = new JPanel(new GridLayout(0, 1)); pane.add(button); pane.add(label); pane.setBorder(BorderFactory.createEmptyBorder(30, // top 30, // left 10, // bottom 30) // right ); return pane; }
From source file:org.zaproxy.zap.extension.soap.ExtensionImportWSDL.java
private ZapMenuItem getMenuImportLocalWSDL() { if (menuImportLocalWSDL == null) { menuImportLocalWSDL = new ZapMenuItem("soap.topmenu.tools.importWSDL", KeyStroke.getKeyStroke(KeyEvent.VK_I, Event.CTRL_MASK, false)); menuImportLocalWSDL//from w ww .ja va2s .c om .setToolTipText(Constant.messages.getString("soap.topmenu.tools.importWSDL.tooltip")); menuImportLocalWSDL.addActionListener(new java.awt.event.ActionListener() { @Override public void actionPerformed(java.awt.event.ActionEvent e) { // Prompt for a WSDL file. final JFileChooser chooser = new JFileChooser( Model.getSingleton().getOptionsParam().getUserDirectory()); FileNameExtensionFilter filter = new FileNameExtensionFilter("WSDL File", "wsdl", "wsdl"); chooser.setFileFilter(filter); int rc = chooser.showOpenDialog(View.getSingleton().getMainFrame()); if (rc == JFileChooser.APPROVE_OPTION) { Thread t = new Thread() { @Override public void run() { this.setName(THREAD_PREFIX + threadId++); parseWSDLFile(chooser.getSelectedFile()); } }; t.start(); } } }); } return menuImportLocalWSDL; }
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);// ww w. j a v a 2 s.co 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); }