Home Java Example Java Awt Menu Shortcuts



Menu Shortcuts
Posted on: December 18, 2008 at 12:00 AM
The MenuItem class also provides a feature of menu shortcuts and speed keys.

Menu Shortcuts

     

The MenuItem class also provides a feature of menu shortcuts and speed keys. You must be familiar with the menu shortcuts such as Ctrl-P which is used to give a print command rather than going to the File menu. A shortcut to any of the MenuItem can be created with the help of MenuItem class. The use of Ctrl for the shortcut key is defined by the Toolkit method which is getMenuShortcutKeyMask().

Lets see how to create menu items with speed keys i.e. Ctrl-P for Print and Shift-Ctrl-P for Print Preview:

file.add (m = new MenuItem ("Print", new MenuShortcut('p'))); 
file.add (m = new MenuItem ("Print Preview", new MenuShortcut('p', true)));

Related Tags for Menu Shortcuts:
cideclassuimenuspeedvikeyidshortcutskeysshortcutmenuitemfeaturesheitdesitemlsshortpeasmclesemmeprocutsspsoeeatkeaandrtssthshofelsoprndo


More Tutorials from this section

Ask Questions?    Discuss: Menu Shortcuts   View All Comments

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.