Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / GUI / April 2005

Tip: Looking for answers? Try searching our database.

cursor in jeditorpane

Thread view: 
shstein2002@yahoo.com - 13 Apr 2005 01:42 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.

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


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.