| Author |
How do I know which object is selected?
|
Amy Phillips
Ranch Hand
Joined: Apr 02, 2003
Posts: 280
|
|
Hi, I have a JTree which is made up of nodes (Tests) and leaves(test steps) when the user clicks on the tree I need to know which item has been selected. However my problem is I am having to cast the selected node to enable me to use it, but obviously need to cast it inot the correct object. I have tried to create a superclass which both the test and the testsep class extend but am still stuck on how I can test to see which type the returned object really is. Thanks
|
 |
Steve Lovelace
Ranch Hand
Joined: Sep 03, 2003
Posts: 125
|
|
You can use either of these expressions: selectedNode.isLeaf() selectedNode.getUserObject() instanceof TestCase You do need to find this out before cast to TestCase. [ April 07, 2004: Message edited by: Steve Lovelace ]
|
The Inner that is named is not the true Inner.
|
 |
Amy Phillips
Ranch Hand
Joined: Apr 02, 2003
Posts: 280
|
|
Thanks Steve
|
 |
 |
|
|
subject: How do I know which object is selected?
|
|
|