The
dragExit
event handler is a special user-defined
Function
that can be added to a component when it is created
and that will be called automatically with a single
DropTargetEvent
or
DragSourceEvent
argument whenever the cursor leaves certain components.
The details, which are discussed below, depend on the type assigned
to the
event
argument in the
dragExit
declaration.
A
dragExit
event handler can only be added via
addEventHandler
after a component is created,
but an existing
dragExit
event handler can always be changed or temporarily disabled,
which is what happens when
NULL,
is assigned to
dragExit.
The type that is assigned to the
event
argument in the declaration of
dragExit
selects the events that
dragExit
receives.
If
event
is declared to be a
DropTargetEvent
then
DragSourceEvents
will not arrive, if it is declared to be a
DragSourceEvent
then
DropTargetEvents
will not arrive, but if
event
is an
Object
then
DropTargetEvents
and
DragSourceEvents
can arrive and
dragExit
should check
event,
usually using
instanceof,
to decide what to do.
Visual effects, like changing the
cursor
when
event
is a
DragSourceEvent,
occasionally need to be updated when the cursor leaves a component,
but other than that there is not much that
dragExit
is used for.
dragExit
receives
DropTargetEvents
when its declaration lets them through and the cursor leaves the component.
dragExit
receives
DragSourceEvents
when its declaration lets them through and the cursor leaves any component
that has accepted the data that this component's
dragGestureRecognized
exported.
Nothing special is required, no matter what kind of
event
arrives, and any return value from
dragExit
will be ignored.
Some Swing components provide automatic drag and drop handling that
currently must be disabled by storing
NULL
in their
transferhandler
field before your drag and drop event handlers will start working.
In other words, you probably should include a declaration that looks
something like,
Object transferhandler = NULL;
whenever you build a Swing component provides its own drag and drop
event handlers.
| |
| Return: |
none
| | |
| See Also: |
actionPerformed,
addEventHandler,
adjustmentValueChanged,
caretUpdate,
componentHidden,
componentMoved,
componentResized,
componentShown,
dragDropEnd,
dragEnter,
DragGestureEvent,
dragGestureRecognized,
dragMouseMoved,
dragOver,
DragSourceEvent,
drop,
dropActionChanged,
DropTargetEvent,
focusGained,
focusLost,
hyperlinkActivated,
hyperlinkEntered,
hyperlinkExited,
invocationAction,
invocationBrowse,
invocationChange,
invocationEdit,
invocationEditImport,
invocationEditKey,
invocationRun,
invocationSelection,
itemStateChanged,
keyPressed,
keyReleased,
keyTyped,
mouseClicked,
mouseDragged,
mouseEntered,
mouseExited,
mouseMoved,
mousePressed,
mouseReleased,
mouseWheelMoved,
removeEventHandler,
stateChanged,
textValueChanged,
valueChanged,
windowActivated,
windowClosed,
windowClosing,
windowDeactivated,
windowDeiconified,
windowIconified,
windowOpened
|
|