java.lang.Object java.awt.dnd.DropTarget
public class 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()
.
DropTarget()
DropTarget
. DropTarget(Component c, DropTargetListener dtl)
DropTarget
given the Component
to associate itself with, and the DropTargetListener
to handle event processing. DropTarget(Component c, int ops, DropTargetListener dtl)
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)
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)
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)
DropTargetListener
(UNICAST SOURCE). void
addNotify(java.awt.peer.ComponentPeer peer)
protected void
clearAutoscroll()
protected DropTarget.DropTargetAutoScroller
createDropTargetAutoScroller(Component c, Point p)
protected DropTargetContext
createDropTargetContext()
void
dragEnter(DropTargetDragEvent dtde)
dragEnter
on the registered DropTargetListener
and passes it the specified DropTargetDragEvent
. void
dragExit(DropTargetEvent dte)
dragExit
on the registered DropTargetListener
and passes it the specified DropTargetEvent
. void
dragOver(DropTargetDragEvent dtde)
dragOver
on the registered DropTargetListener
and passes it the specified DropTargetDragEvent
. void
drop(DropTargetDropEvent dtde)
drop
on the registered DropTargetListener
and passes it the specified DropTargetDropEvent
if this DropTarget
is active. void
dropActionChanged(DropTargetDragEvent dtde)
dropActionChanged
on the registered DropTargetListener
and passes it the specified DropTargetDragEvent
. Component
getComponent()
Component
associated with this DropTarget
. int
getDefaultActions()
int
representing the current action(s) supported by this DropTarget
. DropTargetContext
getDropTargetContext()
DropTargetContext
associated with this DropTarget
. FlavorMap
getFlavorMap()
FlavorMap
associated with this DropTarget
. protected void
initializeAutoscrolling(Point p)
boolean
isActive()
DropTarget
is currently active (ready to accept drops). void
removeDropTargetListener(DropTargetListener dtl)
DropTargetListener
(UNICAST SOURCE). void
removeNotify(java.awt.peer.ComponentPeer peer)
void
setActive(boolean isActive)
true
, inactive if false
. void
setComponent(Component c)
component.setDropTarget(droptarget);
or droptarget.setComponent(component);
void
setDefaultActions(int ops)
DropTarget
void
setFlavorMap(FlavorMap fm)
FlavorMap
associated with this DropTarget
. protected void
updateAutoscroll(Point dragCursorLocn)
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
DropTarget
public DropTarget(Component c, int ops, DropTargetListener dtl, boolean act, FlavorMap fm) throws HeadlessException
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.
c
- The Component
with which this DropTarget
is associated
ops
- The default acceptable actions for this DropTarget
dtl
- The DropTargetListener
for this DropTarget
act
- Is the DropTarget
accepting drops.
fm
- The FlavorMap
to use, or null for the default FlavorMap
HeadlessException
- if GraphicsEnvironment.isHeadless() returns true
GraphicsEnvironment.isHeadless()
public DropTarget(Component c, int ops, DropTargetListener dtl, boolean act) throws HeadlessException
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.
c
- The Component
with which this DropTarget
is associated
ops
- The default acceptable actions for this DropTarget
dtl
- The DropTargetListener
for this DropTarget
act
- Is the DropTarget
accepting drops.
HeadlessException
- if GraphicsEnvironment.isHeadless() returns true
GraphicsEnvironment.isHeadless()
public DropTarget() throws HeadlessException
DropTarget
.
HeadlessException
- if GraphicsEnvironment.isHeadless() returns true
GraphicsEnvironment.isHeadless()
public DropTarget(Component c, DropTargetListener dtl) throws HeadlessException
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.
c
- The Component
with which this DropTarget
is associated
dtl
- The DropTargetListener
for this DropTarget
HeadlessException
- if GraphicsEnvironment.isHeadless() returns true
GraphicsEnvironment.isHeadless()
public DropTarget(Component c, int ops, DropTargetListener dtl) throws HeadlessException
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.
c
- The Component
with which this DropTarget
is associated
ops
- The default acceptable actions for this DropTarget
dtl
- The DropTargetListener
for this DropTarget
HeadlessException
- if GraphicsEnvironment.isHeadless() returns true
GraphicsEnvironment.isHeadless()
public void setComponent(Component c)
component.setDropTarget(droptarget);
or droptarget.setComponent(component);
The Component will receive drops only if it is enabled.
c
- The new Component
this DropTarget
is to be associated with.
public Component getComponent()
Component
associated with this DropTarget
.
public void setDefaultActions(int ops)
DropTarget
ops
- the default actions
DnDConstants
public int getDefaultActions()
int
representing the current action(s) supported by this DropTarget
.
public void setActive(boolean isActive)
true
, inactive if false
.
isActive
- sets the DropTarget
(in)active.
public boolean isActive()
DropTarget
is currently active (ready to accept drops).
true
if active, false
if not
public void addDropTargetListener(DropTargetListener dtl) throws TooManyListenersException
DropTargetListener
(UNICAST SOURCE).
dtl
- The new DropTargetListener
TooManyListenersException
- if a DropTargetListener
is already added to this DropTarget
.
TooManyListenersException
public void removeDropTargetListener(DropTargetListener dtl)
DropTargetListener
(UNICAST SOURCE).
dtl
- the DropTargetListener to deregister.
public void dragEnter(DropTargetDragEvent dtde)
dragEnter
on the registered DropTargetListener
and passes it the specified DropTargetDragEvent
. Has no effect if this DropTarget
is not active.
dragEnter
in interface DropTargetListener
dtde
- the DropTargetDragEvent
NullPointerException
- if this DropTarget
is active and dtde
is null
isActive()
public void dragOver(DropTargetDragEvent dtde)
dragOver
on the registered DropTargetListener
and passes it the specified DropTargetDragEvent
. Has no effect if this DropTarget
is not active.
dragOver
in interface DropTargetListener
dtde
- the DropTargetDragEvent
NullPointerException
- if this DropTarget
is active and dtde
is null
isActive()
public void dropActionChanged(DropTargetDragEvent dtde)
dropActionChanged
on the registered DropTargetListener
and passes it the specified DropTargetDragEvent
. Has no effect if this DropTarget
is not active.
dropActionChanged
in interface DropTargetListener
dtde
- the DropTargetDragEvent
NullPointerException
- if this DropTarget
is active and dtde
is null
isActive()
public void dragExit(DropTargetEvent dte)
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.
dragExit
in interface DropTargetListener
dte
- the DropTargetEvent
isActive()
public void drop(DropTargetDropEvent dtde)
drop
on the registered DropTargetListener
and passes it the specified DropTargetDropEvent
if this DropTarget
is active.
drop
in interface DropTargetListener
dtde
- the DropTargetDropEvent
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.
isActive()
public FlavorMap getFlavorMap()
FlavorMap
associated with this DropTarget
. If no FlavorMap
has been set for this DropTarget
, it is associated with the default FlavorMap
.
public void setFlavorMap(FlavorMap fm)
FlavorMap
associated with this DropTarget
.
fm
- the new FlavorMap
, or null to associate the default FlavorMap with this DropTarget.
public void addNotify(java.awt.peer.ComponentPeer peer)
peer
- The Peer of the Component we are associated with!
public void removeNotify(java.awt.peer.ComponentPeer peer)
peer
- The Peer of the Component we are being disassociated from!
public DropTargetContext getDropTargetContext()
DropTargetContext
associated with this DropTarget
.
DropTargetContext
associated with this DropTarget
.
protected DropTargetContext createDropTargetContext()
protected DropTarget.DropTargetAutoScroller createDropTargetAutoScroller(Component c, Point p)
c
- the Component
p
- the Point
protected void initializeAutoscrolling(Point p)
p
- the Point
protected void updateAutoscroll(Point dragCursorLocn)
dragCursorLocn
- the Point
protected void clearAutoscroll()
Copyright © 2004, 2010 Oracle and/or its affiliates. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4