Solved

multiline tool tip text

Posted on 2001-07-23
3
444 Views
Last Modified: 2012-08-14
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  have tool tip text of single line and that extends tooo long for the complete address.so i need multiple line tooltip text.
0
Comment
Question by:sanjay_thakur
3 Comments
 
LVL 1

Accepted Solution

by:
poluru earned 10 total points
ID: 6311230
u can pass the html to setToolTipText()
like
object.setToolTipText("<html><font color='red'>Chandra Poluru,<br>Hyderabad,<br>A.P..</font></html>");
0
 
LVL 9

Expert Comment

by:Ovi
ID: 6311290
see SwingSet2 demo which comes with your JDK
0
 
LVL 7

Expert Comment

by:tomboshell
ID: 6311727
You will have to customize your own solution.  According to the Javadocs, you will have to "override JComponent's createToolTip method and use a subclass of this class"  'This class' being the JToolTip class.  So, create a new class extending the JToolTip class and then write your own implementation of the method 'setTipText(String tip)'.  You might have to include a line break character.

But I would wonder if using a mouseMotionListener and a JDialog or JPopupMenu wouldn't be better.  Then you write a listener and add it to a component that listens if the mouse is over an area, if over that area then the dialog/pop-up appears and then disappears.  This would be ideal if you want to offer the option of selecting that address to be inserted automatically.  

Hope I didn't confuse too much,
Tom
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

For customizing the look of your lightweight component and making it look lucid like it was made of glass. Or: how to make your component more Apple-ish ;) This tip assumes your component to be of rectangular shape and completely opaque. (COD…
Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

706 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now