Esempio n. 1
0
 /*
  * Post an ActionEvent to the target (on
  * keydown) and the item is enabled.
  * Returns true if there is an associated shortcut.
  */
 boolean handleShortcut(KeyEvent e) {
   MenuShortcut s =
       new MenuShortcut(e.getKeyCode(), (e.getModifiers() & InputEvent.SHIFT_MASK) > 0);
   // Fix For 6185151: Menu shortcuts of all menuitems within a menu
   // should be disabled when the menu itself is disabled
   if (s.equals(shortcut) && isItemEnabled()) {
     // MenuShortcut match -- issue an event on keydown.
     if (e.getID() == KeyEvent.KEY_PRESSED) {
       doMenuEvent(e.getWhen(), e.getModifiers());
     } else {
       // silently eat key release.
     }
     return true;
   }
   return false;
 }
Esempio n. 2
0
 /*
  * Delete a matching MenuShortcut associated with this MenuItem.
  * Used when iterating Menus.
  */
 void deleteShortcut(MenuShortcut s) {
   if (s.equals(shortcut)) {
     shortcut = null;
     MenuItemPeer peer = (MenuItemPeer) this.peer;
     if (peer != null) {
       peer.setLabel(label);
     }
   }
 }
Esempio n. 3
0
 MenuItem getShortcutMenuItem(MenuShortcut s) {
   return (s.equals(shortcut)) ? this : null;
 }