Insert « JTree « Java Swing Q&A





1. Trouble with inserting notes into a JTree    stackoverflow.com

I have a JTree which is constructed with the following method: (The BKMNode class extends DefaultMutableTreeNode, and the DataNode simply holds the data)

 void populateTree(BKMNode parent) {
    for ...

2. Problem in inserting tree in scrollpane    coderanch.com

Hi all, I have problem in inserting the tree and its nodes in scrollpane.Please help me.My code goes here. //tree creation// File pat=new File(str); tree=new JTree(addNodes(null,pat)); jScrollPane5.add(tree); //Add nodes module goes here// DefaultMutableTreeNode addNodes(DefaultMutableTreeNode curTop, File dir) { String curPath = dir.getPath(); File filnam=new File(curPath); DefaultMutableTreeNode curDir = new DefaultMutableTreeNode(filnam.getName().toString()); if (curTop != null) { // should only be null at ...