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