com.droplets.api.event
Class DropEvent

java.lang.Object
  |
  +--java.util.EventObject
        |
        +--com.droplets.api.event.DropEvent
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
TableDropEvent

public class DropEvent
extends java.util.EventObject

Event that is fired when one drag-and-drop-enabled component is dragged onto another.

Since this class extends java.util.EventObject, it inherits the idea of a "source component", which is defined as the component that generates this event, and which is returned by the getSource() method. Be aware that in this case, that component is actually the target of the drop action.

See Also:
Serialized Form

Fields inherited from class java.util.EventObject
source
 
Constructor Summary
DropEvent(Component draggedComponent, Component targetComponent)
          Creates a new DropEvent object.
DropEvent(java.lang.String text, Component targetComponent)
          Creates a new DropEvent object.
 
Method Summary
 Component getDraggedComponent()
          Gets the component that was dragged.
 java.lang.Object getSource()
          As in the superclass, gets the component that generated the event, which in this case is the drop target (the component onto which something was dropped).
 Component getTargetComponent()
          Gets the component onto which something was dropped.
 java.lang.String getText()
          Returns the text that was dropped on the component or null, if text was not dropped.
 
Methods inherited from class java.util.EventObject
toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DropEvent

public DropEvent(Component draggedComponent,
                 Component targetComponent)
Creates a new DropEvent object.
Parameters:
draggedComponent - the component that was originally grabbed by the mouse motion
targetComponent - the component onto which the draggedComponent was dropped, which is also the component that should be creating and dispatching this event

DropEvent

public DropEvent(java.lang.String text,
                 Component targetComponent)
Creates a new DropEvent object.
Parameters:
text - the external text dropped on the component
targetComponent - the component onto which the draggedComponent was dropped, which is also the component that should be creating and dispatching this event
Method Detail

getTargetComponent

public Component getTargetComponent()
Gets the component onto which something was dropped. That component is also considered the "source component" for this event; therefore, the getSource() method returns a reference to the same object.
Returns:
the target component of this drag action

getDraggedComponent

public Component getDraggedComponent()
Gets the component that was dragged.
Returns:
the component that was dragged

getSource

public java.lang.Object getSource()
As in the superclass, gets the component that generated the event, which in this case is the drop target (the component onto which something was dropped).
Overrides:
getSource in class java.util.EventObject
Returns:
the component onto which something was dropped, as a java.lang.Object

getText

public java.lang.String getText()
Returns the text that was dropped on the component or null, if text was not dropped.
Returns:
the text dropped on the component, or null if no text was dropped


Copyright © Droplets, 2001. All Rights Reserved.