Skip to content

Commit 6a59764

Browse files
Shigeru KANEMOTOFederico Fissore
authored andcommitted
newJMenuItem() should use SHORTCUT_KEY_MASK
newJMenuItem() should use SHORTCUT_KEY_MASK variable defined at the top of this class.
1 parent af1828a commit 6a59764

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

app/src/processing/app/Editor.java

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1301,8 +1301,7 @@ public void actionPerformed(ActionEvent e) {
13011301
*/
13021302
static public JMenuItem newJMenuItem(String title, int what) {
13031303
JMenuItem menuItem = new JMenuItem(title);
1304-
int modifiers = Toolkit.getDefaultToolkit().getMenuShortcutKeyMask();
1305-
menuItem.setAccelerator(KeyStroke.getKeyStroke(what, modifiers));
1304+
menuItem.setAccelerator(KeyStroke.getKeyStroke(what, SHORTCUT_KEY_MASK));
13061305
return menuItem;
13071306
}
13081307

@@ -1312,9 +1311,7 @@ static public JMenuItem newJMenuItem(String title, int what) {
13121311
*/
13131312
static public JMenuItem newJMenuItemShift(String title, int what) {
13141313
JMenuItem menuItem = new JMenuItem(title);
1315-
int modifiers = Toolkit.getDefaultToolkit().getMenuShortcutKeyMask();
1316-
modifiers |= ActionEvent.SHIFT_MASK;
1317-
menuItem.setAccelerator(KeyStroke.getKeyStroke(what, modifiers));
1314+
menuItem.setAccelerator(KeyStroke.getKeyStroke(what, SHORTCUT_KEY_MASK | ActionEvent.SHIFT_MASK));
13181315
return menuItem;
13191316
}
13201317

@@ -1325,8 +1322,6 @@ static public JMenuItem newJMenuItemShift(String title, int what) {
13251322
*/
13261323
static public JMenuItem newJMenuItemAlt(String title, int what) {
13271324
JMenuItem menuItem = new JMenuItem(title);
1328-
//int modifiers = Toolkit.getDefaultToolkit().getMenuShortcutKeyMask();
1329-
//menuItem.setAccelerator(KeyStroke.getKeyStroke(what, modifiers));
13301325
menuItem.setAccelerator(KeyStroke.getKeyStroke(what, SHORTCUT_ALT_KEY_MASK));
13311326
return menuItem;
13321327
}

0 commit comments

Comments
 (0)