Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我的自定义组件由JTreea 内的三个 s组成JPanel。一次JTree只能选择一个,因此我TreeSelectionListener为每个调用clearSelection()先前选择的JTree. (有关更多详细信息,请参见此处)。
JTree
JPanel
TreeSelectionListener
clearSelection()
这很好用,但我需要防止s 在取消选择a时TreeSelectionListener触发。一种区分选择事件和取消选择事件的简单方法就足够了。JTree
提前致谢!
只需从树中获取当前选择,如果它为空,则返回。