1. /*
  2. * @(#)DropTargetAdapter.java 1.5 03/01/23
  3. *
  4. * Copyright 2003 Sun Microsystems, Inc. All rights reserved.
  5. * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
  6. */
  7. package java.awt.dnd;
  8. /**
  9. * An abstract adapter class for receiving drop target events. The methods in
  10. * this class are empty. This class exists only as a convenience for creating
  11. * listener objects.
  12. * <p>
  13. * Extend this class to create a <code>DropTargetEvent</code> listener
  14. * and override the methods for the events of interest. (If you implement the
  15. * <code>DropTargetListener</code> interface, you have to define all of
  16. * the methods in it. This abstract class defines a null implementation for
  17. * every method except <code>drop(DropTargetDropEvent)</code>, so you only have
  18. * to define methods for events you care about.) You must provide an
  19. * implementation for at least <code>drop(DropTargetDropEvent)</code>. This
  20. * method cannot have a null implementation because its specification requires
  21. * that you either accept or reject the drop, and, if accepted, indicate
  22. * whether the drop was successful.
  23. * <p>
  24. * Create a listener object using the extended class and then register it with
  25. * a <code>DropTarget</code>. When the drag enters, moves over, or exits
  26. * the operable part of the drop site for that <code>DropTarget</code>, when
  27. * the drop action changes, and when the drop occurs, the relevant method in
  28. * the listener object is invoked, and the <code>DropTargetEvent</code> is
  29. * passed to it.
  30. * <p>
  31. * The operable part of the drop site for the <code>DropTarget</code> is
  32. * the part of the associated <code>Component</code>'s geometry that is not
  33. * obscured by an overlapping top-level window or by another
  34. * <code>Component</code> higher in the Z-order that has an associated active
  35. * <code>DropTarget</code>.
  36. *
  37. * @see DropTargetEvent
  38. * @see DropTargetListener
  39. *
  40. * @author David Mendenhall
  41. * @version 1.5, 01/23/03
  42. * @since 1.4
  43. */
  44. public abstract class DropTargetAdapter implements DropTargetListener {
  45. /**
  46. * Called while a drag operation is ongoing, when the mouse pointer enters
  47. * the operable part of the drop site for the <code>DropTarget</code>
  48. * registered with this listener.
  49. *
  50. * @param dtde the <code>DropTargetDragEvent</code>
  51. */
  52. public void dragEnter(DropTargetDragEvent dtde) {}
  53. /**
  54. * Called when a drag operation is ongoing, while the mouse pointer is still
  55. * over the operable part of the drop site for the <code>DropTarget</code>
  56. * registered with this listener.
  57. *
  58. * @param dtde the <code>DropTargetDragEvent</code>
  59. */
  60. public void dragOver(DropTargetDragEvent dtde) {}
  61. /**
  62. * Called if the user has modified
  63. * the current drop gesture.
  64. *
  65. * @param dtde the <code>DropTargetDragEvent</code>
  66. */
  67. public void dropActionChanged(DropTargetDragEvent dtde) {}
  68. /**
  69. * Called while a drag operation is ongoing, when the mouse pointer has
  70. * exited the operable part of the drop site for the
  71. * <code>DropTarget</code> registered with this listener.
  72. *
  73. * @param dte the <code>DropTargetEvent</code>
  74. */
  75. public void dragExit(DropTargetEvent dte) {}
  76. }