1
0
mirror of https://github.com/arduino/Arduino.git synced 2025-01-18 07:52:14 +01:00

newJMenuItem() should use SHORTCUT_KEY_MASK

newJMenuItem() should use SHORTCUT_KEY_MASK variable defined at the top of this class.
This commit is contained in:
Shigeru KANEMOTO 2013-02-12 21:38:15 +09:00 committed by Federico Fissore
parent af1828a00a
commit 6a59764e0b

View File

@ -1301,8 +1301,7 @@ public class Editor extends JFrame implements RunnerListener {
*/
static public JMenuItem newJMenuItem(String title, int what) {
JMenuItem menuItem = new JMenuItem(title);
int modifiers = Toolkit.getDefaultToolkit().getMenuShortcutKeyMask();
menuItem.setAccelerator(KeyStroke.getKeyStroke(what, modifiers));
menuItem.setAccelerator(KeyStroke.getKeyStroke(what, SHORTCUT_KEY_MASK));
return menuItem;
}
@ -1312,9 +1311,7 @@ public class Editor extends JFrame implements RunnerListener {
*/
static public JMenuItem newJMenuItemShift(String title, int what) {
JMenuItem menuItem = new JMenuItem(title);
int modifiers = Toolkit.getDefaultToolkit().getMenuShortcutKeyMask();
modifiers |= ActionEvent.SHIFT_MASK;
menuItem.setAccelerator(KeyStroke.getKeyStroke(what, modifiers));
menuItem.setAccelerator(KeyStroke.getKeyStroke(what, SHORTCUT_KEY_MASK | ActionEvent.SHIFT_MASK));
return menuItem;
}
@ -1325,8 +1322,6 @@ public class Editor extends JFrame implements RunnerListener {
*/
static public JMenuItem newJMenuItemAlt(String title, int what) {
JMenuItem menuItem = new JMenuItem(title);
//int modifiers = Toolkit.getDefaultToolkit().getMenuShortcutKeyMask();
//menuItem.setAccelerator(KeyStroke.getKeyStroke(what, modifiers));
menuItem.setAccelerator(KeyStroke.getKeyStroke(what, SHORTCUT_ALT_KEY_MASK));
return menuItem;
}