Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / GUI / January 2005

Tip: Looking for answers? Try searching our database.

problem with tooltip on JSpinner

Thread view: 
Thomas Fritsch - 13 Jan 2005 00:41 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.

//----------------------------------------------------------
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('$','@')



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.