Solved

multiline tool tip text

Posted on 2001-07-23
3
467 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.
Suggested Courses

739 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