I used following code
protected DefaultTreeModel m_model;
DefaultMutableTreeNode rootTree = new DefaultMutableTreeNode("My Root", true);
m_model = new DefaultTreeModel(rootTree);
tree = new JTree(m_model);
In future, while posting code, please UseCodeTags. I have added them this time. As you can see it makes the code much more easier to read and understand.
Maneesh Godbole wrote:So how do you want the sorting to be? Level wise? All data?