JDK-4193725 : scrollRowToVisible doesnt work when horizontal and vertical scrolling needed
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 1.2.0
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: generic
  • CPU: unknown
  • Submitted: 1998-12-01
  • Updated: 1999-01-06
  • Resolved: 1999-01-06
Related Reports
Duplicate :  
Description
If you expand a JTree node in a panel, edit a specific child node
and then call scrollRowToVisible() for the selected path, in
some circumstances the tree does not actually scroll to the node
being edited.

To reproduce using the attached test, do the following:

1. Expand the "Rock" node
2. Expand the "Steve Miller Band" node
3. Select the "Joker" node, but DONT expand it!
4. Then press the "Expand and Edit" button

The program then exapnds and starts editing the "Something to believe in" node
and tries to scroll to it. But you will see that the node
is still off screen.

This happens predictably when both horizontal
and vertical scroll bars are needed. It scrolls correctly
if the horizontal scroll bars are not needed, but the test
case should demonstrate the problem. Problem seen in 1.2 RC2. 

Comments
PUBLIC COMMENTS This is happening because when a node is first expanded the size of the tree does not change immediately. Instead revalidate is used. JViewport.scrollRectToVisible has been changed to validate as necessary, refer to bug 4180658 for how this was fixed. scott.violet 1999-01-06
10-06-2004