Is it possible to convert a String variable to a DefaultMutableTreeNode object? Please explain. Context:
String s = new String(outputTagName);
Object s2 = (Object) s;
DefaultMutableTreeNode selectedNode2 =(DefaultMutableTreeNode) s2;
DefaultMutableTreeNode parent2 =(DefaultMutableTreeNode) parent;
model.insertNodeInto(selectedNode2, parent2, parent2.getChildCount());
This is the code, I wrote. This is used within an enumeration that traverses the tree in the BreadthFirstSearch fashion. And the 2nf line gives me this error:
java.lang.ClassCastException: java.lang.String cannot be cast to javax.swing.tree.DefaultMutableTreeNode at ....