Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.gui > #1261 > unrolled thread

Is posible have multiple

Started by"RC" <rc@THRWHITE.remove-dii-this>
First post2011-04-27 15:32 +0000
Last post2011-04-27 15:32 +0000
Articles 2 — 2 participants

Back to article view | Back to comp.lang.java.gui


Contents

  Is posible have multiple "RC" <rc@THRWHITE.remove-dii-this> - 2011-04-27 15:32 +0000
    Re: Is posible have multi "Mark Holland" <mark.holland@THRWHITE.remove-dii-this> - 2011-04-27 15:32 +0000

#1261 — Is posible have multiple

From"RC" <rc@THRWHITE.remove-dii-this>
Date2011-04-27 15:32 +0000
SubjectIs posible have multiple
Message-ID<ets1l8$eph$1@news.nems.noaa.gov>
  To: comp.lang.java.gui,comp.l
I tried

String toolTipText = "Line1\nLine2\rLine3<br />";

myJComponent.setToolTipText(toolTipText);

But I only got the single line.

Is possible to have multiple lines in ToolTip?
If yes, how do I set the multiple line mode?

Thank Q very much in advance!

---
 * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet!
--- Synchronet 3.15a-Win32 NewsLink 1.92
Time Warp of the Future BBS - telnet://time.synchro.net:24

[toc] | [next] | [standalone]


#1262 — Re: Is posible have multi

From"Mark Holland" <mark.holland@THRWHITE.remove-dii-this>
Date2011-04-27 15:32 +0000
SubjectRe: Is posible have multi
Message-ID<ets27l$4vl$1@news.freedom2surf.net>
In reply to#1261
  To: comp.lang.java.gui,comp.l
"RC" <raymond.chui@nospam.noaa.gov> wrote in message 
news:ets1l8$eph$1@news.nems.noaa.gov...
>I tried
>
> String toolTipText = "Line1\nLine2\rLine3<br />";
>
> myJComponent.setToolTipText(toolTipText);
>
> But I only got the single line.
>
> Is possible to have multiple lines in ToolTip?
> If yes, how do I set the multiple line mode?
>
> Thank Q very much in advance!

It is possible to do this, since (I think) tool tips are displayed in 
a kind of customised JLabel.
You were fairly close with your first guess - the answer is to format 
your tool-tip text with html.

e.g.
String toolTipText = "<html>Line1<br>Line2<br>Line3</html>";
myJComponent.setToolTipText(toolTipText);

Of course, if you do this then you need to escape any special html 
characters in your text.
For example, if you want to display the text "a < b\n line2" then you 
need:

String toolTipText = "<html>a &lt; b<br> line2</html";

Because of this, some people have written their own classes which you 
can find using google.
One I found is this http://www.codeguru.com/java/articles/122.shtml, 
although I didn't test it.

Mark

---
 * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet!
--- Synchronet 3.15a-Win32 NewsLink 1.92
Time Warp of the Future BBS - telnet://time.synchro.net:24

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.java.gui


csiph-web