JTree with different colored tree lines?

is it possible to have different colored tree lines between two sibling nodes?

I want to show that these two nodes are linked by having a blue line connecting them. However the entire JTree default color is grey or black angled line. Is possible to have partially different colored lines between certain nodes?


To change the colours of the lines in the tree, you will need to subclass BasicTreeUI and override at least the 4 methods:

An example of extending BasicTreeUI can be found here

Leave a Reply

Your email address will not be published. Required fields are marked *