I have a drag enabled component in my app. Is it possible to disable the drop part? I mean, I'd like to be able to drag elements from this component but I don't want to be able to drop items on it.
Thanks in advance.
Printable View
I have a drag enabled component in my app. Is it possible to disable the drop part? I mean, I'd like to be able to drag elements from this component but I don't want to be able to drop items on it.
Thanks in advance.
As described in the Drag and Drop tutorial, you should replace the default transfer handler of the component.
See: Introduction to Drag and Drop and Data Transfer (The Java™ Tutorials > Creating a GUI with JFC/Swing > Drag and Drop and Data Transfer) for an example.
Yes, I know it. I replaced the default transferhandler with my own. I have two JLists, I need to disable the drop component in the first JList and the the drag component in the second one, so I can only drag items from the first list to the second one, and not the other way around. Is it possible?
Of course it is... if you had read the tutorial you wouldn't ask for it, but here are useful links:
http://java.sun.com/j2se/1.4.2/docs/...abled(boolean)
http://java.sun.com/j2se/1.4.2/docs/...ansferHandler)
I hope it will make sense now,