Problem . The content of the leaf nodes in my tree is HTML, but I do not want them to display as HTML.
Many Swing components can include HTML snippets to change the way they are rendered. This includes nodes a JTree:
DefaultMutableTreeNode myLeafNode = new DefaultMutableTreeNode("<html><body><h1>Hello World</h1></body></html>");
If this node is added to DefaultTreeModel, and the model is added to JTree, it will display the content as HTML.
How to prevent this? How to make it appear as plain text?
Edit : @ David Wallace is responsible (see below). Here's what it looks like:

source
share