Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Swing Component Tool Tips 3

Status
Not open for further replies.

cpope

Programmer
Jul 7, 2000
58
US
I am trying to add a tool tip to my swing components, but the \n for a newline displays a square icon instead of breaking to a new line. Is there a way to display tool tip text on multiple lines?

 
Try it with HTML formatting, and don't forget about the surrounding <html> tags:

<html>this text<br>is multiline</html>
allow thyself to be the spark that lights the fire
haslo@haslo.ch - www.haslo.ch​
 
It worked great! Thanks! I was unable to find this information online, so thank you again ! I voted you for TipMaster of the week

 
Does this work for JLabels as well? I seem to be having problems.

bruce08.gif
 
Actually forget it, I didn't realise the html tags were case sensitive in Java. I cahnged the html tags to lower case and it now works. So for that Haslo gets another star....kerching!::)
bruce56.jpg
 
In general, tooltips should be VERY SHORT; a couple of words, let alone a whole sentence. If you are finding yourself using multi-line tooltips, you are probably using them for the wrong purpose.

Just my 0.02...
 
Basically using a multi-line tooltip to avoid having to create an entire user manual for a simple application... So each field has a one to two line description of what to type / or select in the field, and when to apply certain criteria.... It is not really a &quot;tool-tip&quot; in the Microsoft sense, but it satisfies the purpose :)
 
The reason why my html formatting wouldn't work originally on my home pc is because I was running 1.2.1. It did work on my office PC however (it has 1.2.2) so it appears that html formatting has only been included since 1.2.2.

I do not know how widely known this is - maybe I should have read the release notes. But anyway, worth pointing out as it has caused me a bit of hassle
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top