Hi,
I was making a menu bar for my JFrame, which contains a menu item named "Help".

I'm wondering how to make F1 a shortcut to that menu item. I thought of using .setAccelorator()., but that didn't seem to work.
So can you show me how?

Thanks!

Try to use KeyStroke.getKeyStroke Class with java.awt.event.KeyEvent.VK_F1. and registerKeyboardAction.
that all what you need.

Hope it helps

Could you please be more specific?

Could you please be more specific?

That's as specific as anyone should need to be.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.