< prev index next >

src/java.desktop/share/classes/javax/swing/JMenuItem.java

Print this page




 395             configureAcceleratorFromAction(action);
 396         }
 397         else {
 398             super.actionPropertyChanged(action, propertyName);
 399         }
 400     }
 401 
 402     /**
 403      * Processes a mouse event forwarded from the
 404      * <code>MenuSelectionManager</code> and changes the menu
 405      * selection, if necessary, by using the
 406      * <code>MenuSelectionManager</code>'s API.
 407      * <p>
 408      * Note: you do not have to forward the event to sub-components.
 409      * This is done automatically by the <code>MenuSelectionManager</code>.
 410      *
 411      * @param e   a <code>MouseEvent</code>
 412      * @param path  the <code>MenuElement</code> path array
 413      * @param manager   the <code>MenuSelectionManager</code>
 414      */

 415     public void processMouseEvent(MouseEvent e,MenuElement path[],MenuSelectionManager manager) {
 416         processMenuDragMouseEvent(
 417                  new MenuDragMouseEvent(e.getComponent(), e.getID(),
 418                                         e.getWhen(),
 419                                         e.getModifiers(), e.getX(), e.getY(),
 420                                         e.getXOnScreen(), e.getYOnScreen(),
 421                                         e.getClickCount(), e.isPopupTrigger(),
 422                                         path, manager));
 423     }
 424 
 425 
 426     /**
 427      * Processes a key event forwarded from the
 428      * <code>MenuSelectionManager</code> and changes the menu selection,
 429      * if necessary, by using <code>MenuSelectionManager</code>'s API.
 430      * <p>
 431      * Note: you do not have to forward the event to sub-components.
 432      * This is done automatically by the <code>MenuSelectionManager</code>.
 433      *
 434      * @param e  a <code>KeyEvent</code>
 435      * @param path the <code>MenuElement</code> path array
 436      * @param manager   the <code>MenuSelectionManager</code>
 437      */

 438     public void processKeyEvent(KeyEvent e,MenuElement path[],MenuSelectionManager manager) {
 439         if (DEBUG) {
 440             System.out.println("in JMenuItem.processKeyEvent/3 for " + getText() +
 441                                    "  " + KeyStroke.getKeyStrokeForEvent(e));
 442         }
 443         MenuKeyEvent mke = new MenuKeyEvent(e.getComponent(), e.getID(),
 444                                              e.getWhen(), e.getModifiers(),
 445                                              e.getKeyCode(), e.getKeyChar(),
 446                                              path, manager);
 447         processMenuKeyEvent(mke);
 448 
 449         if (mke.isConsumed())  {
 450             e.consume();
 451         }
 452     }
 453 
 454 
 455 
 456     /**
 457      * Handles mouse drag in a menu.




 395             configureAcceleratorFromAction(action);
 396         }
 397         else {
 398             super.actionPropertyChanged(action, propertyName);
 399         }
 400     }
 401 
 402     /**
 403      * Processes a mouse event forwarded from the
 404      * <code>MenuSelectionManager</code> and changes the menu
 405      * selection, if necessary, by using the
 406      * <code>MenuSelectionManager</code>'s API.
 407      * <p>
 408      * Note: you do not have to forward the event to sub-components.
 409      * This is done automatically by the <code>MenuSelectionManager</code>.
 410      *
 411      * @param e   a <code>MouseEvent</code>
 412      * @param path  the <code>MenuElement</code> path array
 413      * @param manager   the <code>MenuSelectionManager</code>
 414      */
 415     @SuppressWarnings("deprecation")
 416     public void processMouseEvent(MouseEvent e,MenuElement path[],MenuSelectionManager manager) {
 417         processMenuDragMouseEvent(
 418                  new MenuDragMouseEvent(e.getComponent(), e.getID(),
 419                                         e.getWhen(),
 420                                         e.getModifiers(), e.getX(), e.getY(),
 421                                         e.getXOnScreen(), e.getYOnScreen(),
 422                                         e.getClickCount(), e.isPopupTrigger(),
 423                                         path, manager));
 424     }
 425 
 426 
 427     /**
 428      * Processes a key event forwarded from the
 429      * <code>MenuSelectionManager</code> and changes the menu selection,
 430      * if necessary, by using <code>MenuSelectionManager</code>'s API.
 431      * <p>
 432      * Note: you do not have to forward the event to sub-components.
 433      * This is done automatically by the <code>MenuSelectionManager</code>.
 434      *
 435      * @param e  a <code>KeyEvent</code>
 436      * @param path the <code>MenuElement</code> path array
 437      * @param manager   the <code>MenuSelectionManager</code>
 438      */
 439     @SuppressWarnings("deprecation")
 440     public void processKeyEvent(KeyEvent e,MenuElement path[],MenuSelectionManager manager) {
 441         if (DEBUG) {
 442             System.out.println("in JMenuItem.processKeyEvent/3 for " + getText() +
 443                                    "  " + KeyStroke.getKeyStrokeForEvent(e));
 444         }
 445         MenuKeyEvent mke = new MenuKeyEvent(e.getComponent(), e.getID(),
 446                                              e.getWhen(), e.getModifiers(),
 447                                              e.getKeyCode(), e.getKeyChar(),
 448                                              path, manager);
 449         processMenuKeyEvent(mke);
 450 
 451         if (mke.isConsumed())  {
 452             e.consume();
 453         }
 454     }
 455 
 456 
 457 
 458     /**
 459      * Handles mouse drag in a menu.


< prev index next >