Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to bring Help in JMenu and JMenuItem throught F1 Key or Right- Click

843806Nov 15 2007 — edited Nov 15 2007
We want to show Help file for every JMenu and JMenuItem in our application.

Preferably with pressing F1 key when selection is on any JMenu /JMenuItem. Mouse Right-Click is also an option i tried with addMouseListener method, but the mousevent is never fired.

I will appreciate if you can suggest a solution.


What I have tried is the method registerKeyboardAction() which we use for Panel help.
panel.registerKeyboardAction(new ActionListener() {
			public void actionPerformed(ActionEvent evt) {
				//.... Here is Code to open HTML Page
			}
		}, className, KeyStroke.getKeyStroke(KeyEvent.VK_F1, 0, false),
				JComponent.WHEN_IN_FOCUSED_WINDOW);
But in Menu, as always the focus is on last menuitem, help is opened for last menuitem.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 13 2007
Added on Nov 15 2007
3 comments
177 views