JDK-4113750 : JDK1.2, Solaris: JComboBox.setToolTipText() does not work
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 1.0b,1.1.5,1.2.0
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS:
    solaris_2.5.1,solaris_2.6,windows_nt solaris_2.5.1,solaris_2.6,windows_nt
  • CPU: x86,sparc
  • Submitted: 1998-02-20
  • Updated: 1998-09-18
  • Resolved: 1998-09-18
Related Reports
Duplicate :  
Duplicate :  
Description
The following application creates a JComboBox with an associated
JToolTip.

If the cursor is placed over the JComboBox, no tooltip is displayed.
This happens only on Solaris.
Using JDK1.2.
========================================================================

/*
 * ComboBoxBug.java
 * JDK1.2, Solaris: JComboBox.setToolTipText() does not work
 *
*/

import java.awt.BorderLayout;
import java.awt.swing.*;
 
 
public class ComboBoxBug {
 
    public static void main(String[] arg) {
	JFrame frame = new JFrame();
 
	JComboBox combobox = new JComboBox();
 	combobox.setToolTipText("Hi there!");
 	System.out.println("combobox.getToolTipText(): " + combobox.getToolTipText());
 	combobox.addItem("Item 1");
 	combobox.addItem("Item 2");
 	combobox.addItem("Item 3");
 
 
 	JPanel panel = new JPanel(new BorderLayout());
 	panel.add(new JLabel("This combobox has an associated tooltip"), BorderLayout.NORTH);
 	panel.add(combobox, BorderLayout.CENTER);
 
 	frame.getContentPane().add(panel);
 	frame.pack();
	frame.setSize(300,65);
 	frame.setVisible(true);
     }
 }
 
==============================================================
This also happens on win32, again only with the metal look and feel. still hapenning with 1.0.2


daniel.indrigo@Canada 1998-05-12

Comments
EVALUATION Verified this is a bug. Looking into it. richard.schiavi@Eng 1998-04-28 This bug *only* happens with Metal Look and Feel (on Solaris at least: REMIND: verify on Win32). The followin test case mod shows changing the look and feel causes the problem. For some reason the mouselisteners are not working (although they are called and added properly). import java.awt.BorderLayout; import java.awt.*; import java.awt.event.*; import com.sun.java.swing.*; import com.sun.java.swing.event.*; public class ComboBoxBug { public static void main(String[] arg) { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (Exception exc) { System.err.println("Error loading L&F: " + exc); } final JFrame frame = new JFrame(); final JToggleButton button = new JToggleButton("Toggle UI"); button.setToolTipText("Yo!"); button.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e){ if (button.isSelected()){ try { UIManager.setLookAndFeel("com.sun.java.swing.plaf.metal.MetalLookAndFeel"); } catch (Exception g){} } else{ try { UIManager.setLookAndFeel("com.sun.java.swing.plaf.motif.MotifLookAndFeel"); } catch (Exception f){} } SwingUtilities.updateComponentTreeUI(frame); } }); JComboBox combobox = new JComboBox(); combobox.setToolTipText("Hi there!"); System.out.println("combobox.getToolTipText(): " + combobox.getToolTipText()); combobox.addItem("Item 1"); combobox.addItem("Item 2"); combobox.addItem("Item 3"); JPanel panel = new JPanel(new BorderLayout()); panel.add(new JLabel("This combobox has an associated tooltip"), BorderLayout.NORTH); panel.add(button,BorderLayout.EAST); panel.add(combobox, BorderLayout.CENTER); frame.getContentPane().add(panel); frame.pack(); frame.setSize(300,300); frame.setVisible(true); } } richard.schiavi@Eng 1998-04-28 This is not a problem with tool tips. This is due to the compoound component problem (bug id 4144505). I'm marking this as a duplicate of that bug. tom.santos@eng 1998-09-18 I realized that I can do a fix in Combo Box to get around this issue. Bugtraq won't let me reopen this bug so I made a new bug with ID 4174876. The new bug covers the same issue. tom.santos@eng 1998-09-18
18-09-1998