java - How to search a node in outline view in swing -
i have implemented outline view in application consist of 200 node. how can search specific node , expand ?
i have looked breadthfirstenumeration()
, depthfirstenumeration()
method of defaultmutabletreenode
not find equivalent method in outline.
the approach depends on treemodel
used construct outlinemodel
. in filetreemodel
cited, getroot()
returns arbitrary file
representing root of subtree in hierarchical file system. subtree can searched recursively shown here. instead of printing results, accumulate file
instances representing path array. array used construct treepath
. given such treepath
, can reveal corresponding node in manner analogous shown here.
outline.expandpath(treepath); outline.scrollrecttovisible(getpathbounds(treepath));
Comments
Post a Comment