Solved

multiline tool tip text

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

SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

Question has a verified solution.

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

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…
In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:

623 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