チェックボックスツリーを含むパネルがあり、パネルを開くときにツリーにデータを入力します。問題は、チェックボックスツリーで選択するアイテムが多すぎる場合 (約 4000)、パネルを開くのに時間がかかることです。これは私のコードです:
checkBoxTree.getCheckBoxTreeSelectionModel().setDigIn(true);
List<TreePath> paths = new ArrayList<TreePath>();
Enumeration<?> e = projectNode.breadthFirstEnumeration();
while (e.hasMoreElements())
{
IconNode node = (IconNode) e.nextElement();
if(node.isLeaf() && node.isSelected())
paths.add(new TreePath(node.getPath()));
}
TreePath[] array = new TreePath[paths.size()];
array = paths.toArray(new TreePath[0]);
checkBoxTree.getCheckBoxTreeSelectionModel().setSelectionPaths(array);
どんな提案も歓迎されます:)、