Hi all !
In a Swing-application I am trying to create a JSpinner with a tooltip,
but the spinner's tooltip never shows up. (My platform is Java 1.4.2_05)
What is wrong with my code? Or is it a bug of JSpinner itself?
Below you find a stripped-down application for reproducing the problem.
//----------------------------------------------------------
import java.awt.*;
import javax.swing.*;
public class Test
{
public static void main(String[] args)
{
JFrame frame = new JFrame("Test");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
Container contentPane = frame.getContentPane();
contentPane.setLayout(new FlowLayout());
String fontNames[] = {"Courier","Helvetica","Times New Roman"};
JComboBox nameComboBox = new JComboBox(fontNames);
JSpinner sizeSpinner = new JSpinner(new SpinnerNumberModel(12,8,36,1));
nameComboBox.setToolTipText("Font name"); // this tooltip pops up fine
sizeSpinner.setToolTipText("Font size"); // ..and this does not!!
contentPane.add(nameComboBox);
contentPane.add(sizeSpinner);
frame.pack();
frame.setVisible(true);
}
}
//---------------------------------------------------------------------

Signature
Thomas
Thomas Fritsch - 13 Jan 2005 12:00 GMT
> Hi all !
>
> In a Swing-application I am trying to create a JSpinner with a tooltip,
> but the spinner's tooltip never shows up. (My platform is Java 1.4.2_05)
> What is wrong with my code? Or is it a bug of JSpinner itself?
> Below you find a stripped-down application for reproducing the problem.
<source-code example snipped>
Some additonal facts I found meanwhile:
On java 1.4.2_05 / Windows XP, and java 1.4.2_05 / Linux Caldera:
The tooltip shows up *only* when the mouse points exactly on the tiny
black border around the spinner's text-field (a very calm hand is
needed). It does not show up when pointing on any other part (white area
of the text-field, up-button, down-button).
Of course this behaviour is not I want.
On java 1.4.1_02_b06 / Linux Caldera:
The tooltip shows up fine regardless of exact mouse pointer position.

Signature
"Thomas:Fritsch$ops:de".replace(':','.').replace('$','@')
Thomas Fritsch - 13 Jan 2005 12:23 GMT
Thomas Fritsch schrieb:
> Hi all !
>
> In a Swing-application I am trying to create a JSpinner with a tooltip,
> but the spinner's tooltip never shows up. (My platform is Java 1.4.2_05)
> What is wrong with my code? Or is it a bug of JSpinner itself?
> Below you find a stripped-down application for reproducing the problem.
<source-code example snipped>
It is a Sun-bug (reported against java 1.4, fixed in 1.5).
Bug ID: 4680204 JSpinner shows ToolTipText only on it's border
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4680204

Signature
"Thomas:Fritsch$ops:de".replace(':','.').replace('$','@')