[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 287
  • Last Modified:

JTree - editable & moveable

(1)

How can I make it so that the nodes wthin my JTree can be edited?
I wish for the user to be able to double-click on a node, and then type in a new value; and then when they hit return (or whatever), a method of mine is called - which will rename a file based on the new value.

I've got as far as #setEditable( true ). But now what?


(2)

How can I allow nodes to be dragged into other nodes (but only nodes which have sub-nodes).
This is to, in effect, drag files from one folder to another.


Thanks.
0
InteractiveMind
Asked:
InteractiveMind
3 Solutions
 
CEHJCommented:
(1) You'll need to use a custom CellEditor
0
 
CEHJCommented:
(2) The following discusses implementing DnD:

http://www.javaworld.com/javatips/jw-javatip97.html
0
 
InteractiveMindAuthor Commented:
(1) Any examples?

(2) My JTree component is already a drag source; do I merely need to make it a drop source as well, and then go from there?
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
Siva Prasanna KumarPrincipal Solutions ArchitectCommented:
0
 
InteractiveMindAuthor Commented:
Thanks all
0
 
CEHJCommented:
:-)
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now