java.awt.dnd
public class DropTarget extends Object implements DropTargetListener, EventListener, Serializable
Modifier and Type | Class and Description |
---|---|
protected static class |
DropTarget.DropTargetAutoScroller |
Constructor and Description |
---|
DropTarget()
Creates a
DropTarget object. |
DropTarget(Component c,
DropTargetListener dtl)
Creates a
DropTarget object. |
DropTarget(Component c,
int i,
DropTargetListener dtl)
Creates a
DropTarget object. |
DropTarget(Component c,
int i,
DropTargetListener dtl,
boolean b)
Creates a
DropTarget object. |
DropTarget(Component c,
int i,
DropTargetListener dtl,
boolean b,
FlavorMap fm)
Creates a
DropTarget object. |
Modifier and Type | Method and Description |
---|---|
void |
addDropTargetListener(DropTargetListener dtl)
Adds a new
DropTargetListener . |
void |
addNotify(ComponentPeer p) |
protected void |
clearAutoscroll() |
protected DropTarget.DropTargetAutoScroller |
createDropTargetAutoScroller(Component c,
Point p) |
protected DropTargetContext |
createDropTargetContext() |
void |
dragEnter(DropTargetDragEvent dtde)
Called when the cursor hotspot enters a drop site which will accept the
drag.
|
void |
dragExit(DropTargetEvent dte)
Called when the cursor hotspot moves outside of a drop site which will
accept the drag.
|
void |
dragOver(DropTargetDragEvent dtde)
Called when the cursor hotspot moves inside of a drop site which will
accept the drag.
|
void |
drop(DropTargetDropEvent dtde)
Called when the drag operation has terminated with a drop.
|
void |
dropActionChanged(DropTargetDragEvent dtde)
Called when the user modifies the drop gesture.
|
Component |
getComponent()
Returns the component associated with this drop target object.
|
int |
getDefaultActions()
Returns the default actions.
|
DropTargetContext |
getDropTargetContext() |
FlavorMap |
getFlavorMap() |
protected void |
initializeAutoscrolling(Point p) |
boolean |
isActive() |
void |
removeDropTargetListener(DropTargetListener dtl) |
void |
removeNotify(ComponentPeer p) |
void |
setActive(boolean active) |
void |
setComponent(Component c)
Sets the component associated with this drop target object.
|
void |
setDefaultActions(int ops)
Sets the default actions.
|
void |
setFlavorMap(FlavorMap fm) |
protected void |
updateAutoscroll(Point dragCursorLocn) |
public DropTarget()
DropTarget
object.HeadlessException
- If GraphicsEnvironment.isHeadless()
returns true.public DropTarget(Component c, DropTargetListener dtl)
DropTarget
object.HeadlessException
- If GraphicsEnvironment.isHeadless()
returns true.public DropTarget(Component c, int i, DropTargetListener dtl)
DropTarget
object.HeadlessException
- If GraphicsEnvironment.isHeadless()
returns true.public DropTarget(Component c, int i, DropTargetListener dtl, boolean b)
DropTarget
object.HeadlessException
- If GraphicsEnvironment.isHeadless()
returns true.public DropTarget(Component c, int i, DropTargetListener dtl, boolean b, FlavorMap fm)
DropTarget
object.HeadlessException
- If GraphicsEnvironment.isHeadless()
returns true.public void setComponent(Component c)
public Component getComponent()
public void setDefaultActions(int ops)
public int getDefaultActions()
public void setActive(boolean active)
public boolean isActive()
public void addDropTargetListener(DropTargetListener dtl) throws TooManyListenersException
DropTargetListener
.TooManyListenersException
- Sun's JDK does not, despite
documentation, throw this exception here when you install an additional
DropTargetListener
. So to be compatible, we do the same
thing.public void removeDropTargetListener(DropTargetListener dtl)
public void dragEnter(DropTargetDragEvent dtde)
DropTargetListener
dragEnter
in interface DropTargetListener
dtde
- the drag source drag eventpublic void dragOver(DropTargetDragEvent dtde)
DropTargetListener
dragOver
in interface DropTargetListener
dtde
- the drag source drag eventpublic void dropActionChanged(DropTargetDragEvent dtde)
DropTargetListener
dropActionChanged
in interface DropTargetListener
dtde
- the drag source drag eventpublic void dragExit(DropTargetEvent dte)
DropTargetListener
dragExit
in interface DropTargetListener
dte
- the drag source drag eventpublic void drop(DropTargetDropEvent dtde)
DropTargetListener
drop
in interface DropTargetListener
dtde
- the drag source drag eventpublic FlavorMap getFlavorMap()
public void setFlavorMap(FlavorMap fm)
public void addNotify(ComponentPeer p)
public void removeNotify(ComponentPeer p)
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()