• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

To have multi line tooltip text

 
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I need to have a multiline tooltip text...this is to represent the address of a person as the tool tip when the mouse is moved on to it.In general we will have tool tip text of single line and that extends tooo long for the complete address.so i need multiple line tooltip text.
 
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
U can use StringBuffer ,

public String getText(String no) throws Exception
{
StringBuffer Info = new StringBuffer ();
Info.append ( "<html>\n" );
Info.append ( "<body bgcolor='#FFFFEE'>\n" );
Info.append ( "<td>\n" );
Info.append ( str1[i]+"\n" );
Info.append ( "</td>\n" );
:
:
Info.append("<table>\n");
Info.toString();
}

Then u set it in tooltip

JLabel lab=new JLabel()
lab.setToolTipText(getText());
 
author
Posts: 14112
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Use HTML to format the tool tip:

component.setTooltipText("<html>line 1<br>line2<br>line3...</html>");
 
This guy is skipping without a rope. At least, that's what this tiny ad said:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic