|
Quick Lists
|
|
Bug ID:
|
6462604
|
|
Votes
|
1
|
|
Synopsis
|
Ctrl+T with JEditorPane does not scroll correctly from hyperlinks
|
|
Category
|
java:classes_swing
|
|
Reported Against
|
|
|
Release Fixed
|
7(b20)
|
|
State
|
10-Fix Delivered,
bug
|
|
Priority:
|
3-Medium
|
|
Related Bugs
|
4925779
,
4864270
|
|
Submit Date
|
22-AUG-2006
|
|
Description
|
When using an uneditable JEditorPane to display a HTML file that contains hyperlinks to sections within the same page, using Ctrl-T to click such a link does not behave the same as clicking on the link with the mouse.
Clicking with the mouse causes the page to scroll to the corresponding section (expected behavior). Using Ctrl-T causes the page to scroll to the corresponding section, but when the user presses Ctrl-T again to go to the next visible link, the page actually scrolls back to the top, showing that the caret is still at the top of the page.
The user would expect that pressing Ctrl-T at this position in the page would cause the next visible link to receive focus.
Operating System(s): Win32, Windows XP
Full JDK version(s) (from java -version):
All
Steps for recreation:
1)copy given TestFrame.java to any location. Copy index.html to the root directory ("C:\")
2)Use javac to compile TestFrame.java,
3)Then run "java TestFrame" to start the program.
4)A window will appear displaying the HTML text contained in index.html.
First, simply click with the mouse on one of the "alphabetic links" near the top of the page, selecting a letter toward the end of the alphabet (R, S, T...) to cause the page to scroll down. After the click, notice that the page scrolls down to the corresponding section. This is correct behavior.
Scroll back to the top of the page. Use the keyboard to focus on one of the letter links by pressing Ctrl-T. Press Ctrl-Space to activate the link. The page scrolls to the correct position.
But when you press Ctrl-T again, the page scrolls back to the top instead of focusing on the next visible link in the section you were in.
The expected behavior is that after the page has scrolled to the corresponding section, pressing Ctrl-T should focus on the first link in the same section.
Testcase is attached.
Posted Date : 2006-08-22 16:39:32.0
|
|
Work Around
|
N/A
|
|
Evaluation
|
Ctrl+T traverses to the next link to the right from the caret position. E.g. if one uses PgDown to scroll a document then presses Ctrl+T the topmost link will be highlighted. Unfortunately, following hyperlinks leaves the caret at link anchor.
Interestingly, Mozilla does things the opposite way: if a link was followed, pressing Tab will highlight the topmost link (so they don't have this bug). However if one scrolls page using PgDown then presses Tab, the document will be scrolled back.
Posted Date : 2006-11-16 17:30:34.0
The fix is to move caret to the target when same-document links are followed.
Posted Date : 2006-11-16 17:35:14.0
There are more problems with Ctrl+T:
- If you press Ctrl+T (select next link) then Ctrl+Shift+T (select previous link) you'll see two links selected at the same time. This happens because the two instances of HTMLEditorKit.NavigateLinkAction each keep their own selection.
- If you have several editor panes, Ctrl+T selects links in the first pane only. In all the other panes selection is not visible. This happens because the NavigateLinkAction is shared between all the editor kits. It registers a highlight with one editor pane and then tries to use it with another one.
We need to store data in their proper contexts:
- The information about the link selected should be stored in editor kit. Actions for next link and previous link should both access and modify the same data.
- Since NavigateLinkAction is not stateless, there should be different instances for different editor kits.
Posted Date : 2007-07-18 09:15:17.0
|
|
Comments
|
PLEASE NOTE: JDK6 is formerly known as Project Mustang
|
|
|
 |