1. /*
  2. * @(#)MenuDragMouseEvent.java 1.8 01/11/29
  3. *
  4. * Copyright 2002 Sun Microsystems, Inc. All rights reserved.
  5. * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
  6. */
  7. package javax.swing.event;
  8. import javax.swing.MenuElement;
  9. import javax.swing.MenuSelectionManager;
  10. import java.util.EventObject;
  11. import java.awt.event.MouseEvent;
  12. import java.awt.Component;
  13. /**
  14. * MenuDragMouseEvent is used to notify interested parties that
  15. * the menu element has received a MouseEvent forwarded to it
  16. * under drag conditions.
  17. * <p>
  18. * <strong>Warning:</strong>
  19. * Serialized objects of this class will not be compatible with
  20. * future Swing releases. The current serialization support is appropriate
  21. * for short term storage or RMI between applications running the same
  22. * version of Swing. A future release of Swing will provide support for
  23. * long term persistence.
  24. *
  25. * @version 1.8 11/29/01
  26. * @author Georges Saab
  27. */
  28. public class MenuDragMouseEvent extends MouseEvent {
  29. private MenuElement path[];
  30. private MenuSelectionManager manager;
  31. /**
  32. * Constructs a MenuDragMouseEvent object.
  33. *
  34. * @param source the Component that originated the event
  35. * (typically <code>this</code>)
  36. * @param id an int specifying the type of event, as defined
  37. * in {@link java.awt.event.MouseEvent}
  38. * @param when a long identifying the time the event occurred
  39. * @param modifiers an int specifying any modifier keys held down,
  40. * as specified in {@link java.awt.event.InputEvent}
  41. * @param x an int specifying the horizontal position at which
  42. * the event occurred, in pixels
  43. * @param y an int specifying the vertical position at which
  44. * the event occurred, in pixels
  45. * @param clickCount an int specifying the number of mouse-clicks
  46. * @param popupTrigger a boolean -- true if the event {should?/did?}
  47. * trigger a popup
  48. * @param p an array of MenuElement objects specifying a path
  49. * to a menu item affected by the drag
  50. * @param m a MenuSelectionManager object that handles selections
  51. */
  52. public MenuDragMouseEvent(Component source, int id, long when,
  53. int modifiers, int x, int y, int clickCount,
  54. boolean popupTrigger, MenuElement p[],
  55. MenuSelectionManager m) {
  56. super(source, id, when, modifiers, x, y, clickCount, popupTrigger);
  57. path = p;
  58. manager = m;
  59. }
  60. /**
  61. * Returns the path to the selected menu item.
  62. *
  63. * @return an array of MenuElement objects representing the path value
  64. */
  65. public MenuElement[] getPath() {
  66. return path;
  67. }
  68. /**
  69. * Returns the current menu selection manager.
  70. *
  71. * @return a MenuSelectionManager object
  72. */
  73. public MenuSelectionManager getMenuSelectionManager() {
  74. return manager;
  75. }
  76. }