Clicking on a link in my JEditorPane causes a new page to be loaded
into the same pane with setText(). The problem is that the cursor
doesn't change; it's still the link cursor even when it's not over a
link in the new page. And if it is over a link, an entered hyperlink
event is only called when the mouse moves slightly.
Is there a (preferably easy) way to update the cursor properties when
the html page under it changes?
Any help is appreciated
-- Ricardo
Arnaud Berger - 13 Apr 2005 08:32 GMT
Hi,
Just pasting a part of the javadoc for JEditorPane.setText(...) which could
be interesting :
"The assumption is that the previous content is relatively small, and that
the previous content doesn't have side effects. Both of those assumptions
can be violated and cause undesirable results. To avoid this, create a new
document, getEditorKit().createDefaultDocument(), and replace the existing
Document with the new one. You are then assured the previous Document won't
have any lingering state. "
Regards,
Arnaud
> Clicking on a link in my JEditorPane causes a new page to be loaded
> into the same pane with setText(). The problem is that the cursor
[quoted text clipped - 7 lines]
> Any help is appreciated
> -- Ricardo
shstein2002@yahoo.com - 13 Apr 2005 15:27 GMT
Alas, that doesn't do it. Here's my code, where centerkit is the editor
kit for centerpane:
<pre>
public void setText(String s) {
centerpane.setDocument(centerkit.createDefaultDocument());
centerpane.setText(s);
}
</pre>
Can you think of anything else I could try?
-- Ricardo
> Hi,
>
[quoted text clipped - 11 lines]
>
> Arnaud
Arnaud Berger - 14 Apr 2005 07:29 GMT
Hi,
What is your "HyperlinkListener" ?
Haven't you tried the one provided in JEditorPane's javadoc ?
Also setPage(..) will "maybe" do better.
Regards,
Arnaud
> Alas, that doesn't do it. Here's my code, where centerkit is the editor
> kit for centerpane:
[quoted text clipped - 29 lines]
> >
> > Arnaud
Christian Kaufhold - 16 Apr 2005 00:17 GMT
> Clicking on a link in my JEditorPane causes a new page to be loaded
> into the same pane with setText(). The problem is that the cursor
> doesn't change; it's still the link cursor even when it's not over a
> link in the new page. And if it is over a link, an entered hyperlink
> event is only called when the mouse moves slightly.
The Hyperlink-related code in HTMLEditorKit does not react to any
document-changes at all.
> Is there a (preferably easy) way to update the cursor properties when
> the html page under it changes?
Send the JEditorPane a bogus mouseMoved event.
Christian