1. /*
  2. * @(#)MenuKeyEvent.java 1.9 00/02/02
  3. *
  4. * Copyright 1998-2000 Sun Microsystems, Inc. All Rights Reserved.
  5. *
  6. * This software is the proprietary information of Sun Microsystems, Inc.
  7. * Use is subject to license terms.
  8. *
  9. */
  10. package javax.swing.event;
  11. import javax.swing.MenuElement;
  12. import javax.swing.MenuSelectionManager;
  13. import java.util.EventObject;
  14. import java.awt.event.KeyEvent;
  15. import java.awt.Component;
  16. /**
  17. * MenuKeyEvent is used to notify interested parties that
  18. * the menu element has received a KeyEvent forwarded to it
  19. * in a menu tree.
  20. * <p>
  21. * <strong>Warning:</strong>
  22. * Serialized objects of this class will not be compatible with
  23. * future Swing releases. The current serialization support is appropriate
  24. * for short term storage or RMI between applications running the same
  25. * version of Swing. A future release of Swing will provide support for
  26. * long term persistence.
  27. *
  28. * @version 1.9 02/02/00
  29. * @author Georges Saab
  30. */
  31. public class MenuKeyEvent extends KeyEvent {
  32. private MenuElement path[];
  33. private MenuSelectionManager manager;
  34. /**
  35. * Constructs a MenuKeyEvent object.
  36. *
  37. * @param source the Component that originated the event
  38. * (typically <code>this</code>)
  39. * @param id an int specifying the type of event, as defined
  40. * in {@link java.awt.event.KeyEvent}
  41. * @param when a long identifying the time the event occurred
  42. * @param modifiers an int specifying any modifier keys held down,
  43. * as specified in {@link java.awt.event.InputEvent}
  44. * @param keyCode an int specifying the specific key that was pressed
  45. * @param keyChar a char specifying the key's character value, if any
  46. * -- null if the key has no character value
  47. * @param p an array of MenuElement objects specifying a path
  48. * to a menu item affected by the drag
  49. * @param m a MenuSelectionManager object that handles selections
  50. */
  51. public MenuKeyEvent(Component source, int id, long when, int modifiers,
  52. int keyCode, char keyChar,
  53. MenuElement p[], MenuSelectionManager m) {
  54. super(source, id, when, modifiers, keyCode, keyChar);
  55. path = p;
  56. manager = m;
  57. }
  58. /**
  59. * Returns the path to the menu item referenced by this event.
  60. *
  61. * @return an array of MenuElement objects representing the path value
  62. */
  63. public MenuElement[] getPath() {
  64. return path;
  65. }
  66. /**
  67. * Returns the current menu selection manager.
  68. *
  69. * @return a MenuSelectionManager object
  70. */
  71. public MenuSelectionManager getMenuSelectionManager() {
  72. return manager;
  73. }
  74. }