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 / July 2006

Tip: Looking for answers? Try searching our database.

Adding image to JToolTip

Thread view: 
Justin - 25 Jul 2006 10:38 GMT
Is it possible to add images to JToolTip ? I have used HTML to achieve
the same, but the image does  not get loaded. I am using java 1.5 and
the code belongs to an application

Following is the code i used ,

button_object.setToolTipText("<html><img src = \"logo.jpg \" >");

All other( i mean most of the ) HTML commands works with ToolTip
including <ul>  <li> <br> etc But image does not get loaded.Could
somone please help.
When i run this code ( HTML code alone) in the browser it seems to work
fine

thanks in advance

justin
Natasha Lloyd - 25 Jul 2006 18:13 GMT
Here is an article that seems to address your problem:
http://www.javareference.com/jrexamples/viewexample.jsp?id=83

I haven't tried their examples, but maybe it'll help you.

- Natasha -

> Is it possible to add images to JToolTip ? I have used HTML to achieve
> the same, but the image does  not get loaded. I am using java 1.5 and
[quoted text clipped - 13 lines]
>
> justin
Justin - 25 Jul 2006 19:29 GMT
> Here is an article that seems to address your problem:
> http://www.javareference.com/jrexamples/viewexample.jsp?id=83
>
> I haven't tried their examples, but maybe it'll help you.

Hi Natasha ,

Thanks a lot for the suggestion. It worked out. I had be looking for an
answer for quite some time.

The code should have been

String imageName = "file:logo.jpg";
button_obj.setToolTipText("<html>This is an image <img
src="+imageName+"></html>");

Thanks again for your timely help.

with regards
justin

------------------
Andrey  wrote:

> probably it doesnot work because you forgot to close html tag.

hi Andrey  ,

By the way just closing the tag,  </html> did not work  Anyway thanks
for taking the time and answering the query. I checked out the site you
mentioned in your signature

> http://uio.imagero.com Unified I/O for Java
> http://reader.imagero.com Java image reader
> http://jgui.imagero.com Java GUI components and utilities

I have dowloaded the packages. i really liked them. Thanks a lot . i
think they will really help me.

with regards
justin
Andrey Kuznetsov - 25 Jul 2006 19:06 GMT
> button_object.setToolTipText("<html><img src = \"logo.jpg \" >");

probably it doesnot work because you forgot to close html tag.

Andrey

Signature

Andrey Kuznetsov
http://uio.imagero.com Unified I/O for Java
http://reader.imagero.com Java image reader
http://jgui.imagero.com Java GUI components and utilities



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.