Link to home
Start Free TrialLog in
Avatar of Zolf
ZolfFlag for United Arab Emirates

asked on

expalin DefaultMutableTreeNode.getUserObject()

hello there,

Could you anyone tell me what this method does precisely.and when to use it.

DefaultMutableTreeNode.getUserObject()

cheers
zolf
Avatar of Mick Barry
Mick Barry
Flag of Australia image

it returns the object that is associated with the tree node.
you use it whenever you need to access that object
Avatar of Zolf

ASKER


Object obj = tree.getLastSelectedPathComponent();
DefaultMutableTreeNode select = (DefaultMutableTreeNode)obj;
System.out.println(select);

Object uObject = select.getUserObject();
System.out.println(uObject);

both the statements print the same.so what is the difference
you may want to access some property of the user object
Avatar of Zolf

ASKER


for example ??
ASKER CERTIFIED SOLUTION
Avatar of Mick Barry
Mick Barry
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial