Hello -

I'm hoping someone will know a solution to this problem. Here's the deal:

There is some selectable text in a window. When the user selects some of the
text  which represents a tree node in another window, I send that String to my
tree (which sits in a scrollpane) where the proper node is located and
highlighted, and the proper branch is expanded (if collapsed).

The problem is that when a tree branch is collapsed then programmatically
expanded, the scrollRowToVisible does not scroll to show the highlighted node.
The user has to manually scroll.

However, if that proper branch is already expanded, the scrollRowToVisible
does scroll correctly to automatically show the user the newly highlighted
node.

In my tree class which is subclassed from JTree, I use:
setExpandedState(myTreePath, true);
scrollRowToVisible(rowNumInTree);
setSelectionRow(rowNumInTree);

Here's things I've tried but still no soap:
- a repaint()  [just in case it might work]
- scrollPathToVisible(myTreePath)
- moving setSelectionRow(rowNumInTree) above scrollRowToVisible(rowNumInTree)

When the row number is printed out for debugging, it is the correct "row
number" for the tree.
My platform is jdk 1.2.1 on Solaris 8.

Can anyone suggest a remedy for this problem?

Thank-you very much.
Marie.
Software Engineer
0-In Design Automation, San Jose, Ca.
"Zero-In"   http://www.0-In.com


_______________________________________________
Advanced-swing mailing list
[EMAIL PROTECTED]
http://eos.dk/mailman/listinfo/advanced-swing

Reply via email to