CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Mar 2010
    Posts
    4

    Set F1 as the shortcut to a help menu

    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!

  2. #2
    dlorde is offline Elite Member Power Poster
    Join Date
    Aug 1999
    Location
    UK
    Posts
    10,163

    Re: Set F1 as the shortcut to a help menu

    Quote Originally Posted by oontvoo View Post
    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.
    Setting an accelerator on the action should work - that's what they're for. Show us the code you tried that doesn't work.

    You could set a mnemonic (see Menu - Enabling Keyboard Operation), but that's not quite the same thing.

    Being abstract is something profoundly different from being vague... The purpose of abstraction is not to be vague, but to create a new semantic level in which one can be absolutely precise...
    E. Dijkstra
    Last edited by dlorde; May 11th, 2010 at 03:48 AM.
    Please use [CODE]...your code here...[/CODE] tags when posting code. If you get an error, please post the full error message and stack trace, if present.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured