I have a uitree structure and use MultipleSelectionNodes property actived. I always have two nodes selected. I need to fix the selection on one of them permanently while the other can change by mouse selection. How I can achieve that?
To ensure that a particular tree node is always selected, you can write a tree selection listener that will unconditionally select the desired tree node whenever the selection changes. This will have the effect of keeping any tree nodes permanently selected.
tree.addTreeSelectionListener(new TreeSelectionListener(){
@Override
public void valueChanged(TreeSelectionEvent e) {
// set tree selection paths that include a path to your permanent nodes
}
});
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.