1. /*
  2. * @(#)MenuDragMouseEvent.java 1.13 03/12/19
  3. *
  4. * Copyright 2004 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
  21. * appropriate for short term storage or RMI between applications running
  22. * the same version of Swing. As of 1.4, support for long term storage
  23. * of all JavaBeans<sup><font size="-2">TM</font></sup>
  24. * has been added to the <code>java.beans</code> package.
  25. * Please see {@link java.beans.XMLEncoder}.
  26. *
  27. * @version 1.13 12/19/03
  28. * @author Georges Saab
  29. */
  30. public class MenuDragMouseEvent extends MouseEvent {
  31. private MenuElement path[];
  32. private MenuSelectionManager manager;
  33. /**
  34. * Constructs a MenuDragMouseEvent object.
  35. *
  36. * @param source the Component that originated the event
  37. * (typically <code>this</code>)
  38. * @param id an int specifying the type of event, as defined
  39. * in {@link java.awt.event.MouseEvent}
  40. * @param when a long identifying the time the event occurred
  41. * @param modifiers an int specifying any modifier keys held down,
  42. * as specified in {@link java.awt.event.InputEvent}
  43. * @param x an int specifying the horizontal position at which
  44. * the event occurred, in pixels
  45. * @param y an int specifying the vertical position at which
  46. * the event occurred, in pixels
  47. * @param clickCount an int specifying the number of mouse-clicks
  48. * @param popupTrigger a boolean -- true if the event {should?/did?}
  49. * trigger a popup
  50. * @param p an array of MenuElement objects specifying a path
  51. * to a menu item affected by the drag
  52. * @param m a MenuSelectionManager object that handles selections
  53. */
  54. public MenuDragMouseEvent(Component source, int id, long when,
  55. int modifiers, int x, int y, int clickCount,
  56. boolean popupTrigger, MenuElement p[],
  57. MenuSelectionManager m) {
  58. super(source, id, when, modifiers, x, y, clickCount, popupTrigger);
  59. path = p;
  60. manager = m;
  61. }
  62. /**
  63. * Returns the path to the selected menu item.
  64. *
  65. * @return an array of MenuElement objects representing the path value
  66. */
  67. public MenuElement[] getPath() {
  68. return path;
  69. }
  70. /**
  71. * Returns the current menu selection manager.
  72. *
  73. * @return a MenuSelectionManager object
  74. */
  75. public MenuSelectionManager getMenuSelectionManager() {
  76. return manager;
  77. }
  78. }