JEditorPane: HTML show with simple navigate without mouse

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top