I've been using seesaw.tree/simple-tree-model to create my TreeModels, the docs say that this is read only. Originally I didn't need to edit the tree structure however now I do!
There is a pull request in seesaw for adding update-tree!
. Though this is 8 months old.
What is the best way to create and edit JTrees with seesaw / clojure?
Unfortunately, Seesaw's tree support is pretty lame. JTree (and it's just-as-nasty cousin JTable) is extremely complicated so coming up with a clean wrapper that covers a lot of use cases has proven difficult.
Anyway, if you want an editable tree model, you're going to have to either create your own implementation of TreeModel, or build off of DefaultTreeModel, tutorial here. The key with DefaultTreeModel
is to always make modifications (adding/removing children, etc) through the DefaultTreeModel
object rather than the nodes directly. This ensure that events are fired correctly and the tree is repainted, etc. If you find yourself manually calling updateUI
or anything like that on the tree, you're doing something wrong.
Hope this helps. Sorry about the inconvenience. It just makes me sick to think of someone using Seesaw having to do interop :)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With