I have been trying to figure out how to access the current node in a JTree. I have a main class where the tree is defined. When the add button is pressed, the add method from another class is to be invoked. But the listener is defined in the main class, how do I pass the variable to this other class?
Joined: Nov 08, 2009
At this point, I am just trying to see the node content. This piece of code, gives null all the time. I cannot proceed to add till I can identify the node where I have to insert.
Well actually, I have been modifying and test the code so much, I think I put an older version here. The 2nd statement should be just
Joined: Apr 08, 2009
I don't really understand the flow of your application, who calls to actionPerformed? What's the value of the tree at that point? What's doing tree.getLastSelectedPathComponent and why is it returning null?