This week's giveaway is in the EJB and other Java EE Technologies forum.
We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes JTree last selected path component is giving null Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "JTree last selected path component is giving null" Watch "JTree last selected path component is giving null" New topic
Author

JTree last selected path component is giving null

Nageswar Kakolla
Ranch Hand

Joined: Jan 16, 2006
Posts: 71
Hi there,

I am trying to access determine selected node in JTree to delete tree node and i am using

JTree tree = new JTree();

tree.getLastSelectedPathComponent() is seleted node but somehow this is giving null value and i checked tree.getMaxRowCount is 1 meaning i have only two levels in Tree.
Root node and rest of them are childrens

Does anybody throw somelight on this ?

Root
|--child1
|-- child2
|-- child3

etc
above is my tree structure.
i know the logic for deleting of tree node based on selected node

Thanx for help
Sam Codean
Ranch Hand

Joined: Feb 26, 2006
Posts: 194
Can you send me the code snippet. I may be able to help.
Could you also elaborate as to what are you trying to do?
JTree tree = new JTree(); would create only a sample tree and not the kind you require, hope you are not doing something wrong there
[ March 08, 2006: Message edited by: Sam Codean ]

-Sam Codean<br />SCJP 1.4 (98%)<br />SCJD 5.0 (87.5%)
Craig Wood
Ranch Hand

Joined: Jan 14, 2004
Posts: 1535
This seems to work okay. Maybe you can modify it to demonstrate the null values.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JTree last selected path component is giving null
 
Similar Threads
deletion of Node in JTree
JTree
JTree not updating
Checkbox with Jtree
Select a node in Jtree