Solved

multiline tool tip text

Posted on 2001-07-23
3
460 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
couple of eclipse 5 46
ejb mdb examples 1 10
Fast way to search item into Java Array (Rhino compatible) 2 31
Java class and jar 3 25
An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
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 …

830 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