| |
|
| java.lang.Object java.awt.dnd.DropTarget
DropTarget | public class DropTarget implements DropTargetListener,Serializable(Code) | | The DropTarget is associated
with a Component when that Component
wishes
to accept drops during Drag and Drop operations.
Each
DropTarget is associated with a FlavorMap .
The default FlavorMap hereafter designates the
FlavorMap returned by SystemFlavorMap.getDefaultFlavorMap() .
version: 1.59, 06/05/07 since: 1.2 |
Inner Class :protected static class DropTargetAutoScroller implements ActionListener | |
Field Summary | |
int | actions Default permissible actions supported by this DropTarget. | boolean | active true if the DropTarget is accepting Drag & Drop operations. |
Constructor Summary | |
public | DropTarget(Component c, int ops, DropTargetListener dtl, boolean act, FlavorMap fm) Creates a new DropTarget given the Component
to associate itself with, an int representing
the default acceptable action(s) to
support, a DropTargetListener
to handle event processing, a boolean indicating
if the DropTarget is currently accepting drops, and
a FlavorMap to use (or null for the default FlavorMap ). | public | DropTarget(Component c, int ops, DropTargetListener dtl, boolean act) Creates a DropTarget given the Component
to associate itself with, an int representing
the default acceptable action(s)
to support, a DropTargetListener
to handle event processing, and a boolean indicating
if the DropTarget is currently accepting drops. | public | DropTarget() Creates a DropTarget . | public | DropTarget(Component c, DropTargetListener dtl) Creates a DropTarget given the Component
to associate itself with, and the DropTargetListener
to handle event processing. | public | DropTarget(Component c, int ops, DropTargetListener dtl) Creates a DropTarget given the Component
to associate itself with, an int representing
the default acceptable action(s) to support, and a
DropTargetListener to handle event processing. |
Method Summary | |
public synchronized void | addDropTargetListener(DropTargetListener dtl) Adds a new DropTargetListener (UNICAST SOURCE). | public void | addNotify(ComponentPeer peer) Notify the DropTarget that it has been associated with a Component
This method is usually called from java.awt.Component.addNotify() of
the Component associated with this DropTarget to notify the DropTarget
that a ComponentPeer has been associated with that Component. | protected void | clearAutoscroll() | protected DropTargetAutoScroller | createDropTargetAutoScroller(Component c, Point p) | protected DropTargetContext | createDropTargetContext() Creates the DropTargetContext associated with this DropTarget.
Subclasses may override this method to instantiate their own
DropTargetContext subclass.
This call is typically *only* called by the platform's
DropTargetContextPeer as a drag operation encounters this
DropTarget. | void | doSetDefaultActions(int ops) | public synchronized void | dragEnter(DropTargetDragEvent dtde) Calls dragEnter on the registered
DropTargetListener and passes it
the specified DropTargetDragEvent . | public synchronized void | dragExit(DropTargetEvent dte) Calls dragExit on the registered
DropTargetListener and passes it
the specified DropTargetEvent . | public synchronized void | dragOver(DropTargetDragEvent dtde) Calls dragOver on the registered
DropTargetListener and passes it
the specified DropTargetDragEvent . | public synchronized void | drop(DropTargetDropEvent dtde) Calls drop on the registered
DropTargetListener and passes it
the specified DropTargetDropEvent
if this DropTarget is active. | public synchronized void | dropActionChanged(DropTargetDragEvent dtde) Calls dropActionChanged on the registered
DropTargetListener and passes it
the specified DropTargetDragEvent . | public synchronized Component | getComponent() Gets the Component associated
with this DropTarget . | public int | getDefaultActions() Gets an int representing the
current action(s) supported by this DropTarget . | public DropTargetContext | getDropTargetContext() Gets the DropTargetContext associated
with this DropTarget . | public FlavorMap | getFlavorMap() Gets the FlavorMap
associated with this DropTarget . | protected void | initializeAutoscrolling(Point p) | public boolean | isActive() Reports whether or not
this DropTarget
is currently active (ready to accept drops). | public synchronized void | removeDropTargetListener(DropTargetListener dtl) Removes the current DropTargetListener (UNICAST SOURCE). | public void | removeNotify(ComponentPeer peer) Notify the DropTarget that it has been disassociated from a Component
This method is usually called from java.awt.Component.removeNotify() of
the Component associated with this DropTarget to notify the DropTarget
that a ComponentPeer has been disassociated with that Component. | public synchronized void | setActive(boolean isActive) Sets the DropTarget active if true ,
inactive if false . | public synchronized void | setComponent(Component c) Note: this interface is required to permit the safe association
of a DropTarget with a Component in one of two ways, either:
component.setDropTarget(droptarget);
or droptarget.setComponent(component);
The Component will receive drops only if it is enabled. | public void | setDefaultActions(int ops) | public void | setFlavorMap(FlavorMap fm) Sets the FlavorMap associated
with this DropTarget . | protected void | updateAutoscroll(Point dragCursorLocn) |
active | boolean active(Code) | | true if the DropTarget is accepting Drag & Drop operations.
|
DropTarget | public DropTarget(Component c, int ops, DropTargetListener dtl, boolean act, FlavorMap fm) throws HeadlessException(Code) | | Creates a new DropTarget given the Component
to associate itself with, an int representing
the default acceptable action(s) to
support, a DropTargetListener
to handle event processing, a boolean indicating
if the DropTarget is currently accepting drops, and
a FlavorMap to use (or null for the default FlavorMap ).
The Component will receive drops only if it is enabled.
Parameters: c - The Component with which this DropTarget is associated Parameters: ops - The default acceptable actions for this DropTarget Parameters: dtl - The DropTargetListener for this DropTarget Parameters: act - Is the DropTarget accepting drops. Parameters: fm - The FlavorMap to use, or null for the default FlavorMap exception: HeadlessException - if GraphicsEnvironment.isHeadless()returns true See Also: java.awt.GraphicsEnvironment.isHeadless |
DropTarget | public DropTarget(Component c, int ops, DropTargetListener dtl, boolean act) throws HeadlessException(Code) | | Creates a DropTarget given the Component
to associate itself with, an int representing
the default acceptable action(s)
to support, a DropTargetListener
to handle event processing, and a boolean indicating
if the DropTarget is currently accepting drops.
The Component will receive drops only if it is enabled.
Parameters: c - The Component with which this DropTarget is associated Parameters: ops - The default acceptable actions for this DropTarget Parameters: dtl - The DropTargetListener for this DropTarget Parameters: act - Is the DropTarget accepting drops. exception: HeadlessException - if GraphicsEnvironment.isHeadless()returns true See Also: java.awt.GraphicsEnvironment.isHeadless |
DropTarget | public DropTarget(Component c, DropTargetListener dtl) throws HeadlessException(Code) | | Creates a DropTarget given the Component
to associate itself with, and the DropTargetListener
to handle event processing.
The Component will receive drops only if it is enabled.
Parameters: c - The Component with which this DropTarget is associated Parameters: dtl - The DropTargetListener for this DropTarget exception: HeadlessException - if GraphicsEnvironment.isHeadless()returns true See Also: java.awt.GraphicsEnvironment.isHeadless |
DropTarget | public DropTarget(Component c, int ops, DropTargetListener dtl) throws HeadlessException(Code) | | Creates a DropTarget given the Component
to associate itself with, an int representing
the default acceptable action(s) to support, and a
DropTargetListener to handle event processing.
The Component will receive drops only if it is enabled.
Parameters: c - The Component with which this DropTarget is associated Parameters: ops - The default acceptable actions for this DropTarget Parameters: dtl - The DropTargetListener for this DropTarget exception: HeadlessException - if GraphicsEnvironment.isHeadless()returns true See Also: java.awt.GraphicsEnvironment.isHeadless |
addDropTargetListener | public synchronized void addDropTargetListener(DropTargetListener dtl) throws TooManyListenersException(Code) | | Adds a new DropTargetListener (UNICAST SOURCE).
Parameters: dtl - The new DropTargetListener TooManyListenersException if a DropTargetListener is already added to thisDropTarget . |
addNotify | public void addNotify(ComponentPeer peer)(Code) | | Notify the DropTarget that it has been associated with a Component
This method is usually called from java.awt.Component.addNotify() of
the Component associated with this DropTarget to notify the DropTarget
that a ComponentPeer has been associated with that Component.
Calling this method, other than to notify this DropTarget of the
association of the ComponentPeer with the Component may result in
a malfunction of the DnD system.
Parameters: peer - The Peer of the Component we are associated with! |
clearAutoscroll | protected void clearAutoscroll()(Code) | | clear autoscrolling
|
createDropTargetAutoScroller | protected DropTargetAutoScroller createDropTargetAutoScroller(Component c, Point p)(Code) | | create an embedded autoscroller
Parameters: c - the Component Parameters: p - the Point |
createDropTargetContext | protected DropTargetContext createDropTargetContext()(Code) | | Creates the DropTargetContext associated with this DropTarget.
Subclasses may override this method to instantiate their own
DropTargetContext subclass.
This call is typically *only* called by the platform's
DropTargetContextPeer as a drag operation encounters this
DropTarget. Accessing the Context while no Drag is current
has undefined results.
|
doSetDefaultActions | void doSetDefaultActions(int ops)(Code) | | |
dragEnter | public synchronized void dragEnter(DropTargetDragEvent dtde)(Code) | | Calls dragEnter on the registered
DropTargetListener and passes it
the specified DropTargetDragEvent .
Has no effect if this DropTarget
is not active.
Parameters: dtde - the DropTargetDragEvent throws: NullPointerException - if this DropTarget is active and dtde is null See Also: DropTarget.isActive |
dragExit | public synchronized void dragExit(DropTargetEvent dte)(Code) | | Calls dragExit on the registered
DropTargetListener and passes it
the specified DropTargetEvent .
Has no effect if this DropTarget
is not active.
This method itself does not throw any exception
for null parameter but for exceptions thrown by
the respective method of the listener.
Parameters: dte - the DropTargetEvent See Also: DropTarget.isActive |
dragOver | public synchronized void dragOver(DropTargetDragEvent dtde)(Code) | | Calls dragOver on the registered
DropTargetListener and passes it
the specified DropTargetDragEvent .
Has no effect if this DropTarget
is not active.
Parameters: dtde - the DropTargetDragEvent throws: NullPointerException - if this DropTarget is active and dtde is null See Also: DropTarget.isActive |
drop | public synchronized void drop(DropTargetDropEvent dtde)(Code) | | Calls drop on the registered
DropTargetListener and passes it
the specified DropTargetDropEvent
if this DropTarget is active.
Parameters: dtde - the DropTargetDropEvent throws: NullPointerException - if dtde is nulland at least one of the following is true: thisDropTarget is not active, or there isno a DropTargetListener registered. See Also: DropTarget.isActive |
dropActionChanged | public synchronized void dropActionChanged(DropTargetDragEvent dtde)(Code) | | Calls dropActionChanged on the registered
DropTargetListener and passes it
the specified DropTargetDragEvent .
Has no effect if this DropTarget
is not active.
Parameters: dtde - the DropTargetDragEvent throws: NullPointerException - if this DropTarget is active and dtde is null See Also: DropTarget.isActive |
getComponent | public synchronized Component getComponent()(Code) | | Gets the Component associated
with this DropTarget .
the current Component |
getDefaultActions | public int getDefaultActions()(Code) | | Gets an int representing the
current action(s) supported by this DropTarget .
the current default actions |
getDropTargetContext | public DropTargetContext getDropTargetContext()(Code) | | Gets the DropTargetContext associated
with this DropTarget .
the DropTargetContext associated with this DropTarget . |
getFlavorMap | public FlavorMap getFlavorMap()(Code) | | Gets the FlavorMap
associated with this DropTarget .
If no FlavorMap has been set for this
DropTarget , it is associated with the default
FlavorMap .
the FlavorMap for this DropTarget |
initializeAutoscrolling | protected void initializeAutoscrolling(Point p)(Code) | | initialize autoscrolling
Parameters: p - the Point |
isActive | public boolean isActive()(Code) | | Reports whether or not
this DropTarget
is currently active (ready to accept drops).
true if active, false if not |
removeDropTargetListener | public synchronized void removeDropTargetListener(DropTargetListener dtl)(Code) | | Removes the current DropTargetListener (UNICAST SOURCE).
Parameters: dtl - the DropTargetListener to deregister. |
removeNotify | public void removeNotify(ComponentPeer peer)(Code) | | Notify the DropTarget that it has been disassociated from a Component
This method is usually called from java.awt.Component.removeNotify() of
the Component associated with this DropTarget to notify the DropTarget
that a ComponentPeer has been disassociated with that Component.
Calling this method, other than to notify this DropTarget of the
disassociation of the ComponentPeer from the Component may result in
a malfunction of the DnD system.
Parameters: peer - The Peer of the Component we are being disassociated from! |
setActive | public synchronized void setActive(boolean isActive)(Code) | | Sets the DropTarget active if true ,
inactive if false .
Parameters: isActive - sets the DropTarget (in)active. |
setComponent | public synchronized void setComponent(Component c)(Code) | | Note: this interface is required to permit the safe association
of a DropTarget with a Component in one of two ways, either:
component.setDropTarget(droptarget);
or droptarget.setComponent(component);
The Component will receive drops only if it is enabled.
Parameters: c - The new Component this DropTarget is to be associated with. |
setDefaultActions | public void setDefaultActions(int ops)(Code) | | Sets the default acceptable actions for this DropTarget
Parameters: ops - the default actions See Also: java.awt.dnd.DnDConstants
|
setFlavorMap | public void setFlavorMap(FlavorMap fm)(Code) | | Sets the FlavorMap associated
with this DropTarget .
Parameters: fm - the new FlavorMap , or null to associate the default FlavorMap with this DropTarget. |
updateAutoscroll | protected void updateAutoscroll(Point dragCursorLocn)(Code) | | update autoscrolling with current cursor locn
Parameters: dragCursorLocn - the Point |
|
|
|