Reputation: 414
Is it possible to convert String to TreeNode in java Swing?
If yes, how?
Upvotes: 1
Views: 2453
Reputation: 68972
You can't directly cast a String to TreeNode you create a TreeNode because it has to implement the TreeNode or its extension MutableTreeNode interface.
DefaultMutableTreeNode node = new DefaultMutableTreeNode("your string");
For further information and examples see the tutorial
Upvotes: 6