event handler is a special user-defined
that can be added to a component when it is created
and that will be called automatically with a single
argument whenever the user tries to start a drag and drop operation,
which usually happens when mouse button 1 is pressed over the
component and held down while the cursor is dragged a short distance.
event handler can only be added via
after a component is created,
but an existing
event handler can always be changed or temporarily disabled,
which is what happens when
is assigned to
A component that wants to export data using its own drag and drop
event handlers needs a
event handler that returns an
that will be the data transferred by the drag and drop operation.
A return value that is
or missing means the drag and drop operation will not start.
can control other aspects of the drag and drop operation using fields,
that are defined in its
A drag and drop operation that started when
returned the data to be transferred ends when the user drops the data
by releasing the appropriate mouse button or cancels the operation by
key, and at that point the component's
event handler, if there is one, will get a chance to clean up.
Some Swing components provide automatic drag and drop handling that
currently must be disabled by storing
field before your drag and drop event handlers will start working.
In other words, you probably should include a declaration that looks
whenever you build a Swing component provides its own drag and drop
Object transferhandler = NULL;
| See Also: