aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes url tooltip in JEditorPane Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "url tooltip in JEditorPane" Watch "url tooltip in JEditorPane" New topic
Author

url tooltip in JEditorPane

NILESH PATEL
Ranch Hand

Joined: Nov 21, 2000
Posts: 71
Dear all,
I have created a JEditorPane, which takes html page as part of setpage method. The problem is, when html page has a tag like this:
<a href="#chapter4" title="Got to chapter 4">chapter 4</a>
In IE title is displayed as a tooltip, but in JEditorPane, loading same html page, tooltip is not displayed. Does someone know whether I need to use any method from java to turn this feature ON or something similar.
Thanks in advance
Nilesh
Nathan Pruett
Bartender

Joined: Oct 18, 2000
Posts: 4121

I think you would have to implement that yourself... Though I think it would be pretty easy to do. I think that you would extend your JEditorPane's getToolTipText( MouseEvent ) and getToolTipLocation( MouseEvent ) methods. In these methods, find out where the mouse event is and see if there is a link on the JEditorPane at that point. If there is then display a tooltip based on some property of that link. Title is kind of a pain because you'll have to load the html of that page in a buffer and get the title from it. Seems a little bit inefficient...

-Nate


-Nate
Write once, run anywhere, because there's nowhere to hide! - /. A.C.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: url tooltip in JEditorPane