1. /*
  2. * @(#)DragSourceDropEvent.java 1.9 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 java.awt.dnd;
  8. import java.awt.dnd.DragSourceEvent;
  9. import java.awt.dnd.DnDConstants;
  10. /**
  11. * The <code>DragSourceDropEvent</code> is delivered
  12. * from the <code>DragSourceContextPeer</code>,
  13. * via the <code>DragSourceContext</code>, to its currently
  14. * registered <code>DragSourceListener</code>'s dragDropEnd()
  15. * method.
  16. * It contains sufficient information for the
  17. * originator of the operation
  18. * to provide appropriate feedback to the end user
  19. * when the operation completes.
  20. * <P>
  21. * @version 1.9
  22. * <P>
  23. * @since JDK1.2
  24. */
  25. public class DragSourceDropEvent extends DragSourceEvent {
  26. /**
  27. * Construct a <code>DragSourceDropEvent</code> for a drop,
  28. * given the
  29. * <code>DragSourceContext</code>, the drop action,
  30. * and a <code>boolean</code> indicating if the drop was successful.
  31. * <P>
  32. * @param dsc the <code>DragSourceContext</code>
  33. * associated with this <code>DragSourceDropEvent</code>
  34. * @param action the drop action
  35. * @param success a boolean indicating if the drop was successful
  36. */
  37. public DragSourceDropEvent(DragSourceContext dsc, int action, boolean success) {
  38. super(dsc);
  39. dropSuccess = success;
  40. dropAction = action;
  41. }
  42. /**
  43. * Construct a <code>DragSourceDropEvent</code>
  44. * for a drag that does not result in a drop.
  45. * <P>
  46. * @param dsc the <code>DragSourceContext</code>
  47. */
  48. public DragSourceDropEvent(DragSourceContext dsc) {
  49. super(dsc);
  50. dropSuccess = false;
  51. }
  52. /**
  53. * This method returns a <code>boolean</code> indicating
  54. * if the drop was a success.
  55. * <P>
  56. * @return if the drop was successful
  57. */
  58. public boolean getDropSuccess() { return dropSuccess; }
  59. /**
  60. * This method returns an <code>int</code> representing
  61. * the action performed by the target on the subject of the drop.
  62. * <P>
  63. * @return the action performed by the target on the subject of the drop
  64. */
  65. public int getDropAction() { return dropAction; }
  66. /*
  67. * fields
  68. */
  69. private boolean dropSuccess;
  70. private int dropAction = DnDConstants.ACTION_NONE;
  71. }