Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

User Help - JEditorPane

 
CyJenny Wong
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 3451
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Samual Harvey
Ranch Hand
Posts: 119
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
Thomas Fly
Ranch Hand
Posts: 164
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't understand your question. Do you want to right-click, and bring up a popup menu with back & forward choices?
 
Michael Morris
Ranch Hand
Posts: 3451
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 119
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 3451
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 119
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 3451
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 3451
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Samual,
In addition to the above here's the contents page:

Michael Morris
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic