This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Enable/Disable editing of Tree Node

 
kapil Gupta
Ranch Hand
Posts: 89
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I have a JTree with parent nodes and leaf nodes. I want to make the parent nodes editable and leaf nodes non-editable. How can I prevent editing of leaf nodes by user
Thanks,
Kapil
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Make your tree editable, but use a custom TreeCellEditor to prevent leaf cells from being edited. I think pretty much all you'd have to do is extend DefaultTreeCellEditor, and in the getTreeCellEditorComponent() method just call setEditable( !leaf ).
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic