JTree在更新树时避免崩溃节点 [英] JTree avoid collapse node when update the tree

查看:101
本文介绍了JTree在更新树时避免崩溃节点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用树表对象(该示例取自sun站点)..我会在更新模型时防止树节点崩溃,因为每次我需要重新展开所有节点时,这很无聊更新它. 你能帮助我吗? 谢谢!

I'm using a tree table object (the example taken from the sun site)..I would prevent the collapse of the tree nodes when I update the model, because it's boring to re-expand all the nodes everytime I need to update it. Can you help me? Thank you!

推荐答案

在没有看到模型的情况下,并且不知道更新模型"到底是什么意思,只有几个事实

Without seeing the model and without knowing what exactly you mean by "update the model", just a couple of facts

  • 结构更改:不可能,树无法知道/何时/哪些节点与以前相同
  • 插入/删除:请勿触摸不相关节点的扩展状态
  • valueChanged:完全不应该接触扩展状态

检查您的模型实现是否总是触发最窄的事件.然后检查它在普通的JTree中的行为:如果可以的话,则TreeTable有故障(顺便说一句:SwingX有较新的版本:-)

Check your model implementation if it always fires the most narrow event possible. Then check how it behaves in a plain ol' JTree: if it's okay there, then the TreeTable has a glitch (BTW: SwingX has a newer version :-)

这篇关于JTree在更新树时避免崩溃节点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆