I’m creating a JTree and adding some nodes doing something like this:
DefaultMutableTreeNode top = new DefaultMutableTreeNode("The Java Series");
tree = new JTree(top);
...
DefaultMutableTreeNode node = new DefaultMutableTreeNode("<html><a href=\" \">"+code+"</a> "+description+"</html>");
top.add(node);
...
Now I added a “addMouseMotionListener” to the node which is ok. My problem is that the mouse cursor changes whenever I hover over any part of the node. What I really want is to only change mouse cursor when hovering over the HTML hyperlink text part of the node
"<a href=\"\">"+code+"</a>"
and NOT the description.
So is there a way to make the mouse cursor change only when hovering in certain parts of the node?
Thanks in advance.
OK, it took me a while, but what I described in my comment seems to work. There may be other/better ways and I would love to read about it, but so far this is all I have found.
The idea is that:
Here is the code and as a bonus, you also get working hyperlinks!