Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Subtree in JTree

 
Jeevan Anand
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
JTree has root folder invisible. It has folders as child nodes of tree called A, B, C, D.

A, B can contain only leaf nodes.

C, D can contain child nodes as folder and those child folders will have leaf nodes.

The problem is I want C/D should be treated as single tree i.e. user can not move any leaf node of C/D tree to any other folder like A/B...that is 'p' can be moved to Folder2 but not to folder 'A'/ 'B'...How to make these type of settings??



Kindly help me.
[ July 02, 2008: Message edited by: Jeevan Anand ]
 
Craig Wood
Ranch Hand
Pie
Posts: 1535
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I tried to keep this simple to show/emphasize how to customize the drop behavior. There are so many possibilities that it's difficult to say much about it.

Edit: Most of the code in the TransferHandler was taken from the Drag and Drop tutorial.
[ July 04, 2008: Message edited by: Craig Wood ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic