Reputation: 5526
I am using JTree to display channels and members on a network application.
What I wanted to ask is how should I handle the case where members move to different channels. Should I create the tree again (generated from List some objects are other lists) or I can do that dynamically(tree needs to be final to add listeners) .
Also how would each case affect the performance? The tree isn't huge something like 10 parents 10 leaf.
Upvotes: 1
Views: 102
Reputation: 109823
1) you can recreate and populate JTree from its Mode
l, descriptions about DefaultTreeModel, examples here
2) all changes for GUI would be moved to the BackGround Task(s), please look at SwingWorker
or Runnable#Thread
(most easiest way), but Runnable#Thread
required wrapping all output (Swing methods) to the invokeLater
Upvotes: 2