List of usage examples for java.awt.event InputEvent ALT_DOWN_MASK
int ALT_DOWN_MASK
To view the source code for java.awt.event InputEvent ALT_DOWN_MASK.
Click Source Link
From source file:com.haulmont.cuba.desktop.gui.components.DesktopComponentsHelper.java
/** * Convert {@link KeyCombination.Modifier} to {@link InputEvent} modifier constraint. * * @param modifier modifier to convert//from ww w . j a v a 2 s . com * @return {@link InputEvent} modifier constraint */ public static int convertModifier(KeyCombination.Modifier modifier) { switch (modifier) { case CTRL: return InputEvent.CTRL_DOWN_MASK; case ALT: return InputEvent.ALT_DOWN_MASK; case SHIFT: return InputEvent.SHIFT_DOWN_MASK; default: throw new IllegalArgumentException("Modifier " + modifier.name() + " not recognized"); } }
From source file:com.varaneckas.hawkscope.cfg.Configuration.java
/** * Parses hotkey string and returns int value of modifier. * I.e.: InputEvent.CTRL_DOWN_MASK/*from ww w . j ava 2 s.c om*/ * * @return InputEvent modifier value */ public int getHotkeyModifier() { final String hotkey = properties.get(HOTKEY_REPR); if (hotkey != null && hotkey.contains("+")) { //good hotkey if (hotkey.startsWith("Shift")) { return InputEvent.SHIFT_DOWN_MASK; } if (hotkey.startsWith("Ctrl")) { return InputEvent.CTRL_DOWN_MASK; } if (hotkey.startsWith("Alt")) { return InputEvent.ALT_DOWN_MASK; } if (hotkey.startsWith("Win") || hotkey.startsWith("Command")) { return InputEvent.META_DOWN_MASK; } } //bad hotkey or no hotkey return -1; }
From source file:com.net2plan.gui.GUINet2Plan.java
private void start() { setExtendedState(JFrame.MAXIMIZED_BOTH); setMinimumSize(new Dimension(800, 600)); itemObject = new DualHashBidiMap<JMenuItem, Object>(); URL iconURL = GUINet2Plan.class.getResource("/resources/gui/icon.png"); ImageIcon icon = new ImageIcon(iconURL); setIconImage(icon.getImage());/* w w w .ja v a 2 s .co m*/ setTitle("Net2Plan"); setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); addWindowListener(CLOSE_NET2PLAN); getContentPane().setLayout(new MigLayout("insets 0 0 0 0", "[grow]", "[grow]")); container = new JPanel(new MigLayout("", "[]", "[]")); container.setBorder(new LineBorder(Color.BLACK)); container.setLayout(new MigLayout("fill")); getContentPane().add(container, "grow"); /* Create menu bar */ menu = new JMenuBar(); setJMenuBar(menu); /* File menu */ JMenu file = new JMenu("File"); file.setMnemonic('F'); menu.add(file); optionsItem = new JMenuItem("Options"); optionsItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_O, InputEvent.ALT_DOWN_MASK)); optionsItem.addActionListener(this); file.add(optionsItem); classPathEditorItem = new JMenuItem("Classpath editor"); classPathEditorItem.addActionListener(this); file.add(classPathEditorItem); errorConsoleItem = new JMenuItem("Show Java console"); errorConsoleItem.addActionListener(this); errorConsoleItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F12, InputEvent.ALT_DOWN_MASK)); file.add(errorConsoleItem); exitItem = new JMenuItem("Exit"); exitItem.addActionListener(this); exitItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F4, InputEvent.ALT_DOWN_MASK)); file.add(exitItem); /* Help menu */ JMenu help = new JMenu("Help"); help.setMnemonic('H'); menu.add(help); aboutItem = new JMenuItem("About"); aboutItem.addActionListener(this); help.add(aboutItem); itemObject.put(aboutItem, showAbout()); helpItem = new JMenuItem("User's guide"); helpItem.addActionListener(this); helpItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F1, KeyEvent.VK_UNDEFINED)); help.add(helpItem); javadocItem = new JMenuItem("Library API Javadoc"); javadocItem.addActionListener(this); help.add(javadocItem); javadocExamplesItem = new JMenuItem("Built-in Examples Javadoc"); javadocExamplesItem.addActionListener(this); help.add(javadocExamplesItem); keyCombinationItem = new JMenuItem("Show tool key combinations"); keyCombinationItem.addActionListener(this); keyCombinationItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_K, KeyEvent.ALT_DOWN_MASK)); help.add(keyCombinationItem); usedKeyStrokes = new LinkedHashSet<KeyStroke>(); refreshMenu(); container.add(showAbout(), "align center"); container.revalidate(); new JFileChooser(); /* Do not remove! It is used to avoid slow JFileChooser first-time loading once Net2Plan is shown to the user */ setVisible(true); }
From source file:com.net2plan.gui.tools.GUINetworkDesign.java
@Override public KeyStroke getKeyStroke() { return KeyStroke.getKeyStroke(KeyEvent.VK_1, InputEvent.ALT_DOWN_MASK); }
From source file:nz.govt.natlib.ndha.manualdeposit.ManualDepositMain.java
private void checkHotKey(java.awt.event.KeyEvent evt) { if ((evt.getModifiersEx() & InputEvent.ALT_DOWN_MASK) != 0) { if (evt.getKeyCode() == KeyEvent.VK_1) { showSearch(true);//from w ww . j ava 2s .c om } else if (evt.getKeyCode() == KeyEvent.VK_2) { showMetaData(true); } } else if ((evt.getModifiersEx() & InputEvent.CTRL_DOWN_MASK) != 0) { if (evt.getKeyCode() == KeyEvent.VK_S) { showSearch(true); } else if (evt.getKeyCode() == KeyEvent.VK_M) { showMetaData(true); } } if (evt.getKeyCode() == KeyEvent.VK_F5) { depositPresenter.refreshFileList(); } }
From source file:nz.govt.natlib.ndha.manualdeposit.ManualDepositMain.java
private void treeStructMapKeyPressed(java.awt.event.KeyEvent evt) { if ((evt.getModifiersEx() & InputEvent.ALT_DOWN_MASK) != 0) { if (evt.getKeyCode() == KeyEvent.VK_DOWN) { moveItem(false);//from ww w . j a va2 s . c om } else if (evt.getKeyCode() == KeyEvent.VK_UP) { moveItem(true); } } }
From source file:nz.govt.natlib.ndha.manualdeposit.ManualDepositMain.java
private void treeFileSystemKeyTyped(java.awt.event.KeyEvent evt) { if ((evt.getModifiersEx() & InputEvent.ALT_DOWN_MASK) != 0) { processFileSystemKey(evt.getKeyChar()); }//from w ww . ja v a 2 s.c o m stopEditingTree(); }
From source file:nz.govt.natlib.ndha.manualdeposit.ManualDepositMain.java
private void treeEntitiesKeyTyped(java.awt.event.KeyEvent evt) { if (evt.getKeyChar() == KeyEvent.VK_DELETE) { depositPresenter.deleteEntity(); } else {// w w w . j a v a2 s .c om if ((evt.getModifiersEx() & InputEvent.ALT_DOWN_MASK) != 0) { if (evt.getKeyChar() == 's') { depositPresenter.createAutoStructItem(false); } else if (evt.getKeyChar() == 'r') { depositPresenter.createAutoStructItem(true); } processFileSystemKey(evt.getKeyChar()); } } }
From source file:nz.govt.natlib.ndha.manualdeposit.ManualDepositMain.java
private void treeEntitiesKeyPressed(java.awt.event.KeyEvent evt) { if ((evt.getModifiersEx() & InputEvent.ALT_DOWN_MASK) != 0) { if (evt.getKeyCode() == KeyEvent.VK_DOWN) { moveItem(false);/*from w ww .j a v a 2 s. c om*/ } else if (evt.getKeyCode() == KeyEvent.VK_UP) { moveItem(true); } } }
From source file:org.eclipse.jubula.client.ui.rcp.constants.InputCodeHelper.java
/** * private constructor//from w w w.j a va 2 s . c om * */ private InputCodeHelper() { m_modifier[0] = InputEvent.CTRL_DOWN_MASK; m_modifier[1] = InputEvent.CTRL_DOWN_MASK | InputEvent.SHIFT_DOWN_MASK; m_modifier[2] = InputEvent.CTRL_DOWN_MASK | InputEvent.ALT_DOWN_MASK; m_modifier[3] = InputEvent.ALT_DOWN_MASK; m_modifier[4] = InputEvent.ALT_DOWN_MASK | InputEvent.SHIFT_DOWN_MASK; m_modifier[5] = 0; // no modifier pressed List<UserInput> inputList = new ArrayList<UserInput>(); List<String> inputStringList = new ArrayList<String>(); for (int i = KeyEvent.VK_0; i <= KeyEvent.VK_9; i++) { inputList.add(new UserInput(i, InputConstants.TYPE_KEY_PRESS)); inputStringList.add(KeyEvent.getKeyText(i)); } for (int i = KeyEvent.VK_A; i <= KeyEvent.VK_Z; i++) { inputList.add(new UserInput(i, InputConstants.TYPE_KEY_PRESS)); inputStringList.add(KeyEvent.getKeyText(i)); } for (int i = KeyEvent.VK_NUMPAD0; i <= KeyEvent.VK_ADD; i++) { inputList.add(new UserInput(i, InputConstants.TYPE_KEY_PRESS)); inputStringList.add(KeyEvent.getKeyText(i)); } for (int i = KeyEvent.VK_SUBTRACT; i <= KeyEvent.VK_DIVIDE; i++) { inputList.add(new UserInput(i, InputConstants.TYPE_KEY_PRESS)); inputStringList.add(KeyEvent.getKeyText(i)); } for (int i = KeyEvent.VK_F1; i <= KeyEvent.VK_F12; i++) { inputList.add(new UserInput(i, InputConstants.TYPE_KEY_PRESS)); inputStringList.add(KeyEvent.getKeyText(i)); } m_modifierString = new String[m_modifier.length]; for (int i = 0; i < m_modifier.length; i++) { m_modifierString[i] = InputEvent.getModifiersExText(m_modifier[i]); } m_keys = inputList.toArray(new UserInput[inputList.size()]); m_keyStrings = inputStringList.toArray(new String[inputStringList.size()]); inputList.add(new UserInput(InputConstants.MOUSE_BUTTON_LEFT, InputConstants.TYPE_MOUSE_CLICK)); inputList.add(new UserInput(InputConstants.MOUSE_BUTTON_MIDDLE, InputConstants.TYPE_MOUSE_CLICK)); inputList.add(new UserInput(InputConstants.MOUSE_BUTTON_RIGHT, InputConstants.TYPE_MOUSE_CLICK)); inputStringList.add(Messages.ObjectMappingPreferencePageMouseButton1); inputStringList.add(Messages.ObjectMappingPreferencePageMouseButton2); inputStringList.add(Messages.ObjectMappingPreferencePageMouseButton3); m_inputs = inputList.toArray(new UserInput[inputList.size()]); m_inputStrings = inputStringList.toArray(new String[inputStringList.size()]); }