R
Romano Signorelli
Hello,
I would like to use JEditorPane to make a simple HTML viewer with browsing
support, through use of keyboard (NO MOUSE).
I will use it to display some little help pages in HTML format.
With the keyboard, I would like to:
- Scroll the page up/down (example: arrow up/down)
- Highlight the links on the page, one by one, by selecting it with, for
example, arrow left/right
- Jump to the link highlighted (e.g.: Enter key)
- Return to the previous page (e.g.: ESC key)
So, upon loaded an HTML page in the JEditorPane, I've started to get
information about the links (a href) located on it.
I've got the dest. links throught the HTMLDocument, the iterator and
AttributeSet.
The big problem now is: how to locate exactly a link on the graphical page
(x, y position) and how highlight it
Tryied: I used a DefaultHighlighter with a simple g.drawRect(), but my
rectangle seems to disappear when a new HTML page loads. Furthermore, I
don't know how to locate exacltly the graphical position of a link to
correctly draw a box around it (hightlight). In my tryes I've drawn it in a
fixed position. This position will change dinamically (e.g.: when the page
scroll, when selecting another link, etc).
Any ideas? Please help me, if you can, about:
- how to get information about a link on an HTML doc and highlight it on
JEditorPane
Thanks in advance, bye
Romano Signorelli
I would like to use JEditorPane to make a simple HTML viewer with browsing
support, through use of keyboard (NO MOUSE).
I will use it to display some little help pages in HTML format.
With the keyboard, I would like to:
- Scroll the page up/down (example: arrow up/down)
- Highlight the links on the page, one by one, by selecting it with, for
example, arrow left/right
- Jump to the link highlighted (e.g.: Enter key)
- Return to the previous page (e.g.: ESC key)
So, upon loaded an HTML page in the JEditorPane, I've started to get
information about the links (a href) located on it.
I've got the dest. links throught the HTMLDocument, the iterator and
AttributeSet.
The big problem now is: how to locate exactly a link on the graphical page
(x, y position) and how highlight it
Tryied: I used a DefaultHighlighter with a simple g.drawRect(), but my
rectangle seems to disappear when a new HTML page loads. Furthermore, I
don't know how to locate exacltly the graphical position of a link to
correctly draw a box around it (hightlight). In my tryes I've drawn it in a
fixed position. This position will change dinamically (e.g.: when the page
scroll, when selecting another link, etc).
Any ideas? Please help me, if you can, about:
- how to get information about a link on an HTML doc and highlight it on
JEditorPane
Thanks in advance, bye
Romano Signorelli