Which component do I have to use for a mouse-tooltip

Hi!

I want to open a small tooltip at the mouse position, just like a button tooltip. The tooltip should follow the mouse pointer and display the mouse position coordinates.

publicvoid mouseMoved(MouseEvent e){

if (mouseTip ==null){

mouseTip =new JFrame();

mouseTip.setSize(20, 20);

mouseTip.setLocation(e.getX(),e.getY());

mouseTip.setVisible(true);

...

Principally it works, but the Frame is too heavy. Which component is used for the classic button-tooltip and how can I use it?

Thanks in advance

Message was edited by:

carodita

[865 byte] By [caroditaa] at [2007-11-27 11:06:09]
# 1

JComponent supports tooltips, you can use the setToolTip method to set the text of it.

http://java.sun.com/docs/books/tutorial/uiswing/components/tooltip.html

hunter9000a at 2007-7-29 13:13:24 > top of Java-index,Java Essentials,Java Programming...
# 2

try JWindow.

JWindow tooltip=new JWindow();

tooltip.setLocation(e.getX(),e.getY());

student@sunDNa at 2007-7-29 13:13:24 > top of Java-index,Java Essentials,Java Programming...
# 3

That's it! Thank you!

caroditaa at 2007-7-29 13:13:24 > top of Java-index,Java Essentials,Java Programming...