I’m developing a simple drawing application in Java. I’m restricted to using an AWT MenuBar (Not JMenuBar), and I need to set a few keyboard shortcuts and I can’t find how to do so. I need shortcuts for two MenuItems and for three CheckBoxMenuItems.
It would go something like this:
newItem = Ctrl+N
quitItem = Ctrl+Q
rectangleItem = Ctrl+R
ovalItem = Ctrl+O
lineItem = Ctrl+L
Since the suggestion in the comments seems to have fixed at least part of your problem, I’m gonna put it here as an answer for users in the future.
Read the second half of this documentation and change your
MenuItemconstructors to take in aMenuShortcutas their second argument, like this (taken from the linked docs):