Controling width of tool tip

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
karthikasok
Posts: 11
Joined: Thu Jul 13, 2006 11:38 am

Controling width of tool tip

Post by karthikasok » Wed Aug 23, 2006 3:02 pm

hi,

How can i control the width of a tooltip. If the string
i display on the tooltip is very large the tooltip occupies
the whole screen and even goes beyond that. Ay idea

thanks in advance

karthikasok
Posts: 11
Joined: Thu Jul 13, 2006 11:38 am

Post by karthikasok » Thu Aug 24, 2006 10:53 am

i tried giving the newline character in the string.
but it takes '\n' as a string only and dispays a single line.

david.gilbert
JFreeChart Project Leader
Posts: 11734
Joined: Fri Mar 14, 2003 10:29 am
antibot: No, of course not.
Contact:

Post by david.gilbert » Thu Aug 24, 2006 11:00 am

More recent versions of Swing support HTML in tooltips I think, so you could try adding <br> tags.
David Gilbert
JFreeChart Project Leader

:idea: Read my blog
:idea: Support JFree via the Github sponsorship program

karthikasok
Posts: 11
Joined: Thu Jul 13, 2006 11:38 am

Post by karthikasok » Thu Aug 24, 2006 11:39 am

im using jdk 1.5. but the html tags still doesnt work

david.gilbert
JFreeChart Project Leader
Posts: 11734
Joined: Fri Mar 14, 2003 10:29 am
antibot: No, of course not.
Contact:

Post by david.gilbert » Thu Aug 24, 2006 1:19 pm

OK, sorry for the misinformation. I'm sure I saw this working somewhere...when I get a chance, I'll try it out. I guess there is a possibility that this is LookAndFeel specific - which one are you using?
David Gilbert
JFreeChart Project Leader

:idea: Read my blog
:idea: Support JFree via the Github sponsorship program

skunk
Posts: 1087
Joined: Thu Jun 02, 2005 10:14 pm
Location: Brisbane, Australia

Post by skunk » Thu Aug 24, 2006 1:40 pm

All swing text components support the display of HTML. For example

Code: Select all

"<html><body>line1<br>line2</body></html>"
will be displayed as 2 lines

potterd64
Posts: 13
Joined: Fri Aug 18, 2006 7:54 pm

Post by potterd64 » Thu Aug 24, 2006 10:54 pm

the <br> tags wont work by themselves, but if you enclose the whole string in <html></html> tags it'll accept the <br> tags.

karthikasok
Posts: 11
Joined: Thu Jul 13, 2006 11:38 am

Post by karthikasok » Fri Aug 25, 2006 2:27 pm

oh great.
Thanks a lot. It works great :D

szanjad
Posts: 1
Joined: Wed Sep 20, 2006 7:22 am
Contact:

Tool tip width

Post by szanjad » Wed Sep 20, 2006 7:29 am

Tool tip width can be controlled by setting the property for the overlib... Nothing special needs to be done other than setting this attribute in your javascript :-)
However difficult the task, if One Man can do it, then everyone can.

Sunil Z

Locked