-
Bug
-
Resolution: Unresolved
-
P4
-
None
-
1.4.0, 5.0
-
generic, x86
-
generic
This bug identifies a family of issues with the text package when used to model and render text whose visualization doesn't start with position 0 in the model. The root of the problem is that the text package makes the assumption that position 0 in the model is the first visual position on the screen. With HTML for example, this is not correct since position 0 belongs to the head of the document, which is not displayed on screen. The following are some of the ramifications of this bad assumption:
1) When a JEditorPane containing HTML is first created, the caret position is set to 0. As such, when the pane gains focus, the caret is not visible (since position 0 is not a visible position). Note that sometimes a small black dot is seen in the upper left where the caret should be (a rendering mistake?).
2) When the HOME key is pressed on the first line of text in a JEditorPane containing HTML, the caret dissapears off the screen.
3) When the "select all" action is invoked on a JEditorPane, it begins selection at position 0 and goes through to the end of the document. This may work currently, but really, only the text visible on the screen should be selected.
The methods that make the bad assumptions are scattered throughout the text package. In particular, DefaultEditorKit, JTextComponent, and DefaultCaret call either setCaretPosition, setDot, or moveCaretPosition with a parameter of 0.
1) When a JEditorPane containing HTML is first created, the caret position is set to 0. As such, when the pane gains focus, the caret is not visible (since position 0 is not a visible position). Note that sometimes a small black dot is seen in the upper left where the caret should be (a rendering mistake?).
2) When the HOME key is pressed on the first line of text in a JEditorPane containing HTML, the caret dissapears off the screen.
3) When the "select all" action is invoked on a JEditorPane, it begins selection at position 0 and goes through to the end of the document. This may work currently, but really, only the text visible on the screen should be selected.
The methods that make the bad assumptions are scattered throughout the text package. In particular, DefaultEditorKit, JTextComponent, and DefaultCaret call either setCaretPosition, setDot, or moveCaretPosition with a parameter of 0.
- duplicates
-
JDK-5102369 JEditorPane sets its caret position into <head> section in HTML doc after initia
-
- Closed
-
- relates to
-
JDK-5043626 JEditorPane inserts chars into <head> section instead of <body> in HTML doc
-
- Resolved
-