L
Lizard
OK
I have a JList, whose ListModel is a list of a class specific to my
app, with a toString() method so it displays properly. I have a custom
component which draws these objects in an appropriate fashion. I want
to drag from the JList to this object.
Now: I have the basic DnD working -- I can currently drag from the
list to the object and have something happen. Currently, though, all I
can access is the standard text dragging.
I understand I need to add a Transferable or a Dataflavor or something
to handle dragging a serializable object type, but I am lost in a maze
of twisty little APIs, all alike. Can anyone provide a simple
step-by-step sequence on how to get this working?
The list does not need to ever accept a drop; the other components
needs to accept only drops of the appropriate object type and never
needs to accept a drag.
I'm currently kludging it by having my form (on which both objects
reside) tell the receiving object what object was selected from the
list when the drop started, then, when the drop is complete, the
receiver uses that info to do its thing, ignoring the actual content
of the drop event. This is so painfully ugly I want to kill myself.
I have a JList, whose ListModel is a list of a class specific to my
app, with a toString() method so it displays properly. I have a custom
component which draws these objects in an appropriate fashion. I want
to drag from the JList to this object.
Now: I have the basic DnD working -- I can currently drag from the
list to the object and have something happen. Currently, though, all I
can access is the standard text dragging.
I understand I need to add a Transferable or a Dataflavor or something
to handle dragging a serializable object type, but I am lost in a maze
of twisty little APIs, all alike. Can anyone provide a simple
step-by-step sequence on how to get this working?
The list does not need to ever accept a drop; the other components
needs to accept only drops of the appropriate object type and never
needs to accept a drag.
I'm currently kludging it by having my form (on which both objects
reside) tell the receiving object what object was selected from the
list when the drop started, then, when the drop is complete, the
receiver uses that info to do its thing, ignoring the actual content
of the drop event. This is so painfully ugly I want to kill myself.