is new.
java.lang.Objectjava.awt.dnd.DropTarget
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().
| Nested Class Summary | |
|---|---|
| protected static class |
DropTarget.DropTargetAutoScroller
this protected nested class implements autoscrolling |
| Constructor Summary | |
|---|---|
|
DropTarget
() Creates a DropTarget. |
|
|
DropTarget
(
Component
c,
DropTargetListener
dtl) Creates a DropTarget given the Component to associate itself with, and the DropTargetListener to handle event processing. |
|
|
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. |
|
|
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. |
|
|
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). |
|
| Method Summary | |
|---|---|
| void |
addDropTargetListener
(
DropTargetListener
dtl) Adds a new DropTargetListener (UNICAST SOURCE). |
| void |
addNotify
(java.awt.peer.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
() clear autoscrolling |
| protected DropTarget.DropTargetAutoScroller |
createDropTargetAutoScroller
(
Component
c,
Point
p) create an embedded autoscroller |
| protected DropTargetContext |
createDropTargetContext
() Creates the DropTargetContext associated with this DropTarget. |
| void |
dragEnter
(
DropTargetDragEvent
Calls dragEnter on
and passes it the specified DropTargetDragEvent.
|
| void |
dragExit
(
DropTargetEvent
Calls dragExit on
and passes it the specified DropTargetEvent.
|
| void |
dragOver
(
DropTargetDragEvent
Calls dragOver on
and passes it the specified DropTargetDragEvent.
|
| void |
drop
(
DropTargetDropEvent
Calls drop on
and passes it the specified DropTargetDropEvent if this DropTarget is active.
|
| void |
dropActionChanged
(
DropTargetDragEvent
Calls dropActionChanged on
and passes it the specified DropTargetDragEvent.
|
| Component |
getComponent
() Gets the Component associated with this DropTarget. |
| int |
getDefaultActions
() Gets an int representing the current action(s) supported by this DropTarget. |
| DropTargetContext |
getDropTargetContext
() Gets the DropTargetContext associated with this DropTarget. |
| FlavorMap |
getFlavorMap
() Gets the FlavorMap associated with this DropTarget. |
| protected void |
initializeAutoscrolling
(
Point
p) initialize autoscrolling |
| boolean |
isActive
() Reports whether or not this DropTarget is currently active (ready to accept drops). |
| void |
removeDropTargetListener
(
DropTargetListener
dtl) Removes the current DropTargetListener (UNICAST SOURCE). |
| void |
removeNotify
(java.awt.peer.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. |
| void |
setActive
(boolean isActive) Sets the DropTarget active if true, inactive if false. |
| 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); |
| void |
setDefaultActions
(int ops) Sets the default acceptable actions for this DropTarget |
| void |
setFlavorMap
(
FlavorMap
fm) Sets the FlavorMap associated with this DropTarget. |
| protected void |
updateAutoscroll
(
Point
dragCursorLocn) update autoscrolling with current cursor locn |
| Methods inherited from class java.lang. Object |
|---|
| clone , equals , finalize , getClass , hashCode , notify , notifyAll , toString , wait , wait , wait |
| Constructor Detail |
|---|
public DropTarget(Component c,
int ops,
DropTargetListener dtl,
boolean act,
FlavorMap fm)
throws HeadlessException
The Component will receive drops only if it is enabled.
public DropTarget(Component c,
int ops,
DropTargetListener dtl,
boolean act)
throws HeadlessException
The Component will receive drops only if it is enabled.
public DropTarget()
throws HeadlessException
public DropTarget(Component c,
DropTargetListener dtl)
throws HeadlessException
The Component will receive drops only if it is enabled.
public DropTarget(Component c,
int ops,
DropTargetListener dtl)
throws HeadlessException
The Component will receive drops only if it is enabled.
| Method Detail |
|---|
public void setComponent(Component c)
The Component will receive drops only if it is enabled.
public Component getComponent()
public void setDefaultActions(int ops)
public int getDefaultActions()
public void setActive(boolean isActive)
public boolean isActive()
public void addDropTargetListener(DropTargetListener dtl)
throws TooManyListenersException
public void removeDropTargetListener(DropTargetListener dtl)
public void dragEnter(DropTargetDragEvent dtde)
Calls dragEnter on the registered DropTargetListener and passes it the specified DropTargetDragEvent. Has no effect if this DropTarget is not active.
Throws:
NullPointerException
- if this DropTarget is active and dtde is null
See Also:
isActive()
public void dragOver(DropTargetDragEvent dtde)
Calls dragOver on the registered DropTargetListener and passes it the specified DropTargetDragEvent. Has no effect if this DropTarget is not active.
Throws:
NullPointerException
- if this DropTarget is active and dtde is null
See Also:
isActive()
public void dropActionChanged(DropTargetDragEvent dtde)
Calls dropActionChanged on the registered DropTargetListener and passes it the specified DropTargetDragEvent. Has no effect if this DropTarget is not active.
Throws:
NullPointerException
- if this DropTarget is active and dtde is null
See Also:
isActive()
public void dragExit(DropTargetEvent dte)
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.
See Also:
isActive()
public void drop(DropTargetDropEvent dtde)
Calls drop on the registered DropTargetListener and passes it the specified DropTargetDropEvent if this DropTarget is active.
Throws:
NullPointerException
- if dtde is null and at least one of the following is true: this DropTarget is not active, or there is no a DropTargetListener registered.
See Also:
isActive()
public FlavorMap getFlavorMap()
public void setFlavorMap(FlavorMap fm)
public void addNotify(java.awt.peer.ComponentPeer peer)
public void removeNotify(java.awt.peer.ComponentPeer peer)
public DropTargetContext getDropTargetContext()
protected DropTargetContext createDropTargetContext()
protected DropTarget.DropTargetAutoScroller createDropTargetAutoScroller(Component c,
Point p)
protected void initializeAutoscrolling(Point p)
protected void updateAutoscroll(Point dragCursorLocn)
protected void clearAutoscroll()