ManthanB
ManthanB

Reputation: 414

How can I cast String to TreeNode in java Swing?

Is it possible to convert String to TreeNode in java Swing?

If yes, how?

Upvotes: 1

Views: 2453

Answers (1)

stacker
stacker

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

Related Questions