permaculture playing cards*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes User Help - JEditorPane Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "User Help - JEditorPane" Watch "User Help - JEditorPane" New topic
Author

User Help - JEditorPane

CyJenny Wong
Greenhorn

Joined: May 29, 2002
Posts: 18
I'm not using HTMLEditorKit to write my userhelp.html, I'm using a normal texteditor instead. In the html file, I've internal link within the document (e.g "Go to top"), it works fine when I load it using browser but when I attached it to the JEditorPane, those links didn't work. What should I do??
Michael Morris
Ranch Hand

Joined: Jan 30, 2002
Posts: 3451
Hi CyJenny,
Have you attached a HyperlinkListener to your JEditorPane and implemented the hyperlinkUpdate() method? That's what you need to do to follow links
(<a> tags).
Hope this helps,
Michael Morris


Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius - and a lot of courage - to move in the opposite direction. - Ernst F. Schumacher
Samual Harvey
Ranch Hand

Joined: Aug 06, 2002
Posts: 119
I am using JeditorPane and HyperlinkListener works fine.
But, how can I implement mouse right click with back and forward. Is this simple or I have to write painful custom code to do this.
[ September 11, 2002: Message edited by: Samual Harvey ]

Samual Harvey<br />SCJP2<br />SCJD2
Thomas Fly
Ranch Hand

Joined: Sep 09, 2002
Posts: 164
I don't understand your question. Do you want to right-click, and bring up a popup menu with back & forward choices?


Fly by Night Consultants<br /> <blockquote><font size="1" face="Verdana, Arial">quote:</font><hr><i>I climbed on the back of a giant albatross<br />which flew through a crack in the cloud<br />to a place where happiness reigned...<br />all year 'round<br />the music played ever so loudly!</i><p><a href="http://thomasfly.com/songs/Traffic/Hole_in_my_Shoe_qt.htm" target="_blank" rel="nofollow">Hole in My Shoe</a><hr></blockquote>
Michael Morris
Ranch Hand

Joined: Jan 30, 2002
Posts: 3451
Hi Samual:

But, how can I implement mouse right click with back and forward. Is this simple or I have to write painful custom code to do this.

As far as I know, you'll have to roll-your-own on this one. It probably wouldn't be too difficult. You'll have to keep a collection of visited hyperlinks, either in the JEditorPane itself or its enclosing component, attach a MouseListener to it, and popup a menu with back and forward items. So when the user presses the back item, you pop the most recent item from the collection and use it to setPage().
Hope this helps,
Michael Morris
Samual Harvey
Ranch Hand

Joined: Aug 06, 2002
Posts: 119
Yes thats what I was thinking that I may have to do. Seems that I'll look into this if time permits otherwise wont do it. BTW did u do this?
Michael Morris
Ranch Hand

Joined: Jan 30, 2002
Posts: 3451
Hi Samual,

BTW did u do this?

Nope. But I did use frame tags which allowed for easy navigation.

Michael Morris
Samual Harvey
Ranch Hand

Joined: Aug 06, 2002
Posts: 119
What do you mean by frame tags? Are these the built in hyperlinks when you create the javadoc or something else?
Michael Morris
Ranch Hand

Joined: Jan 30, 2002
Posts: 3451
Hi Samual,
I mean a framed HTML document where the hyperlinks are on the left side of the page and the main document is on the right. So when a user selects one of the links on the contents frame (on the left) then the page will display that page on the main frame (on the right).
Here's the index page for my client help files:

Hope this helps,
Michael Morris
Michael Morris
Ranch Hand

Joined: Jan 30, 2002
Posts: 3451
Hi Samual,
In addition to the above here's the contents page:

Michael Morris
 
jQuery in Action, 2nd edition
 
subject: User Help - JEditorPane
 
Similar Threads
HELP with ScrollPanes!
Setting a JEditorPane to use JLabel's default font when using HTML
How to add a component to JEditorPane
HTML with JEditorPane
JEditorPane is a Pain