Hi, Given a partially expanded JTree, I'm trying to determine the next visible leaf from the currently selected tree node. This may or may not be a child/sibling of the current node, and could easily have multiple nodes expanded. I have two ideas doing this. Option 1: View the JTree simple as a single columned table, and find the next leaf 'down' the column, irresepective of parent. The problem here, is that I'm having difficulty determining row number, and i'm not even sure if that is the right way to do this Option 2: Write some ridiculously complex traversing logic that goes 'up' and 'down' parent/child/sibling nodes, hunting for the next visible leaf. I've tried using nextLeaf and other similar methods, but there is no distinction between leaves in collapsed or expanded nodes. I'd really really like to do Option 1, (or at least fully investigate it before attempting Option 2) just because it seems both the easiest to implement and the most concise logic. Thanks in advance, and sorry this is a bit of a long one! :-)
Joined: Aug 04, 2003
Given a node in the tree, next visible node (downwards) should be either 1) it's sibling or 2) sibling of it's parent.