开发者

Is there a fast way to expand many paths in a JTree?

I have a large JTree and I need to expand thousands of nodes all at once. Right now, that is taking a long time. I think it's because it's firing notifications and doing all the work for every one. Is there some way to tell it to expand all the nodes in a batch so it only has to update things once afterwards?

Or some other way to make expandin开发者_Go百科g lots of nodes in a batch faster?


Have you tried disabling the tree's event listeners? That way it won't fire off events every time you modify the tree. Something like this:

setVisible(false);
tree.removeTreeWillExpandListener(this);
tree.removeTreeSelectionListener(this);

//modify the tree

tree.addTreeSelectionListener(this);
tree.addTreeWillExpandListener(this);
setVisible(true);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜