• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to show TooltipText with different text

 
joan wo
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have an applicattion that uses a JPanel to display a image using imageComponent method. When the users pressed the mouse over any position of the image, I want to display a ToolTipText or similar showing a little information of the pixel in question (color, position,...). How can I make it?
I know how to assign a ToolTipText to a button for example, but I need to change the message on every mouse clik.


Thank's!!
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65519
105
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"joan",

There aren't many rules that you need to worry about here on the Ranch, but one that we take very seriously regards the use of proper names. Please take a look at the JavaRanch Naming Policy and adjust your display name to match it.

In particular, your display name must be a first and a last name separated by a space character, and must not be obviously fictitious.

Thanks!
bear
JavaRanch Sheriff
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
if you want to display something as a result of a mouseClick,
perhaps a JPopupMenu() might suit you better

http://java.sun.com/docs/books/tutorial/uiswing/components/menu.html#popup
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!