Skip to main content

using Robot to expand/collapse JTree?

No replies
jiangshachina
Offline
Joined: 2006-05-05
Points: 0

root
  - node1
    + node11
    - node12
  - node2
  - node3
    - node31
      + node311
    + node31

I want to expand/collapse JTree by using Robot, but I don't know how to get the position of tree node "handle" (+, -).
Please note that: I just want to click the node "handle" to expand/collapse the nodes, but not to double-click the tree nodes to do that.

Although I can use method JTree.getPathBounds(TreePath) to get the node bounds, I don't know what's the exact point of the handle ;-(