JDK-6917744 : JScrollPane Page Up/Down keys do not handle correctly html tables with different cells contents
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 6u17
  • Priority: P3
  • Status: Closed
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2010-01-18
  • Updated: 2011-02-16
  • Resolved: 2010-04-06
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 6 JDK 7
6u19-rev b07Fixed 7Fixed
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
25-03-2010

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.
17-02-2010

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
05-02-2010