I have a Jtree
and I need to remove the highlight effect on certain node.
So, now I have this for alla nodes
and I would like have this on certain node:
How can I achieve this ? Thanks
I have a Jtree
and I need to remove the highlight effect on certain node.
So, now I have this for alla nodes
and I would like have this on certain node:
How can I achieve this ? Thanks
Could you not maybe use something like this ? Unsure of practicality and not tested it
tree.addMouseListener (new MouseAdapter (){
public void mousePressed ( MouseEvent e ){
// Check for right click
if (SwingUtilities.isRightMouseButton(e)){
int selection[] = tree.getSelectionRows();
for(int i=0; i< selection.size; i++){
tree.removeSelectionInterval(selection[i], selection[i]);
}
}
}
-First: you need to set an object (with your own property) to the node with the following method:
Remember to implement
toString
method in Group class-Second: Create a new class that extends
DefaultTreeCellRenderer
and overridegetTreeCellRendererComponent
like this:-Third: set your renderer to tree: