United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: 6917744 JScrollPane Page Up/Down keys do not handle correctly html tables with different cells contents
6917744 : JScrollPane Page Up/Down keys do not handle correctly html tables with different cells contents

Details
Type:
Bug
Submit Date:
2010-01-18
Status:
Closed
Updated Date:
2011-02-16
Project Name:
JDK
Resolved Date:
2010-04-06
Component:
client-libs
OS:
generic
Sub-Component:
javax.swing
CPU:
generic
Priority:
P3
Resolution:
Fixed
Affected Versions:
6u17
Fixed Versions:
6u19-rev

Related Reports
Backport:
Backport:
Backport:
Backport:

Sub Tasks

Description
Using PageDown key to scroll a HTML table in a JScrollPane does not
stop scrolling at the bottom of the table if the table contains cells 
with different content heights. It will then scroll up to the bottom 
of the latest cell content (most right cell with smaller height).

see testcase attached

                                    

Comments
SUGGESTED FIX

http://jpsesvr.sfbay.sun.com:8080/ctetools/html/ViewDetail.jsp?index=3450
                                     
2010-03-25
EVALUATION

The previous code changes caret position regardless of its view position. You can see that old code moves caret position at lines 466-471 and then
adjusts visible rect at line 481. But when caret position is changed the javax.swing.text.DefaultCaret#changeCaretPosition method schedules another visible rect adjustment:
   Runnable callRepaintNewCaret = new Runnable() {
           public void run() {
       repaintNewCaret(); // This method makes caret visible
       }
   };
   SwingUtilities.invokeLater(callRepaintNewCaret);

As the result it's possible the following situation:
1. A user presses PgDn
2. JEditorPane changes caret position to a new one with a higher view position
3. JEditorPane scrolls one screen down from an initial Y position
4. JEditorPane makes caret position visible (code in the DefaultCaret#changeCaretPosition method) and scrolls to the new caret position (see item 2). It's possible to see that JEditorPane blinks (because both items 3 and 4 changes scroll position in short period) and scrolls up

My fix permits to change caret position (see item 2) in case a new view caret position has upward direction with PgUp (or PgDn). So new behavior looks like this: if a user press PgDn JEditorPane scrolls one screen down. Caret position will be changed if and only if its view position *not higher* initial scroll position.
                                     
2010-02-17
EVALUATION

This is a bug indeed

and it doesn't seem to be related to JScrollPane,
you can try to add the JEditorPane directly to the panel
and reproduce the same behaviour

So the problem is somewhere in the actions
that handle scrolling for html content
                                     
2010-02-05



Hardware and Software, Engineered to Work Together