-
Bug
-
Resolution: Fixed
-
P3
-
1.2.2
-
beta
-
x86
-
windows_nt
Name: vi73552 Date: 06/21/99
C:\>java -version
java version "1.2.2"
Classic VM (build JDK-1.2.2-U, native threads, symcjit)
C:\>java -fullversion
java full version "JDK-1.2.2-U"
Calling setToolTipText() with a null parameter when the
component you're setting the tooltip for is no longer in
focus, disables the display of subsequent tooltips on that
component. An example is below. To replicate the problem in
the example, before pressing the button in the panel, move
the mouse around till you tooltips are displayed. Then,
press the button. Now, move the mouse around the panel again.
Tooltips won't come up this time. The mouse must move off the
panel in order for the panel to be able to display tooltips
again.
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class A extends JFrame
{
public A()
{
super();
final JPanel p = new JPanel(new FlowLayout());
setContentPane(p);
p.addMouseMotionListener(new MouseMotionAdapter()
{
public void mouseMoved(MouseEvent ev)
{
p.setToolTipText(ev.getX() + " , " + ev.getY());
}
public void mouseDrag(MouseEvent ev)
{
//Notice that this as no effect as we already have the focus
p.setToolTipText(null);
}
});
final JButton btn = new JButton("Clicking here disables tooltips for the panel");
btn.addActionListener( new ActionListener()
{
public void actionPerformed(ActionEvent ev)
{
//This will disable subsequent tooltips till the frame loses the focus
p.setToolTipText(null);
}
});
p.add(btn);
}
public static void main(String args[] )
{
A a = new A();
a.setSize(400, 400);
a.setVisible(true);
}
}
(Review ID: 84568)
======================================================================