I am developing a small desktop application in Net beans. I drag and drop a JTree on my JFrame and now i want to fill the node hierarchy of this this JTree dynamically. For this i wrote a method which return me DefaultMutableTreeNode object. Now i again create tree with this object but the tree still shows old (default) nodes:
DefaultMutableTreeNode root = createJTreeNodes();
jTree1 = new JTree(root);
jTree1.repaint();
jTree1.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
Could any one guide that what i need to change, in order to populate tree dynamically?
Could any one guide that what i need to change, in order to populate tree dynamically?
A couple of different options:
or