Help with expanding nodes during DnD Drop in JTree

Hello!

I am trying to get my Drag and Drop in JTree method work a little better, and a little more like Windows Explorer.

When I drag from my source and hoovers the mouse over my JTree, it selects the node I am hoovering over, which is all good. However, IF the user stays hoovered over a node (that has collapsed children) ~1 second, I would like that node to be expanded, so the user may drop it onto a child, or expand a child even further.

This should only take place when I am actually dragging something to the tree, and not just hoovering with the mouse cursor.

This behaviour is very common in applications these days and to me it seems like this *should* be availible with some clever TreeSelectionListener or similar, but I can't find anything that seems to help. I dont really feel like implementing a mouse listener, and wait for "stayed on the same node for 1 second" event types :)

Regards

phettan

Message was edited by:

phettan

[999 byte] By [phettana] at [2007-11-27 2:30:21]
# 1
shameless bump
phettana at 2007-7-12 2:44:01 > top of Java-index,Desktop,Core GUI APIs...
# 2

Found a blogpost by Shannon Hickey (http://weblogs.java.net/blog/shan_man/archive/2006/01/first_class_dra.html) where he says:

"Finally, I'd like to draw your attention to one additional ease of use feature added for JTree Drag and Drop in Mustang: during a drag operation, hovering the mouse over a collapsed folder node for two seconds causes the folder to be expanded, making it possible to drop within its list of children."

So I guess it is a waiting game.

phettana at 2007-7-12 2:44:01 > top of Java-index,Desktop,Core GUI APIs...