Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4787979

JComboBox getToolTipLocation does not work

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P4 P4
    • None
    • 1.4.1
    • client-libs



      Name: jk109818 Date: 12/03/2002


      FULL PRODUCT VERSION :
      java version "1.4.1_01"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1_01-b01)
      Java HotSpot(TM) Client VM (build 1.4.1_01-b01, mixed mode)


      FULL OPERATING SYSTEM VERSION :

      Microsoft Windows XP [Version 5.1.2600]


      A DESCRIPTION OF THE PROBLEM :
      For swing fields, e.g., JTextField, JCheckBox,
      getToolTipLocation lets the user choose where the tooltip is
      displayed. This does not seem to work with JComboBox.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      1. compile and run source below
      2.
      3.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      I expected the tooltip to be above the combobox just the
      text field. It was not.

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import java.awt.*;
      import java.awt.event.*;
      import javax.swing.*;

      public class bugCombo extends JFrame {

         public class P extends JPanel {
         P()
         {
            setLayout(new FlowLayout(FlowLayout.LEFT));

            JComboBox combo = new JComboBox(new String[] {"ABC", "DEF"}) {
               public Point getToolTipLocation(MouseEvent e) {
                  System.out.println("Combo tool tip");
                  // Move tool tip to above field
                  return new Point(getWidth()/2, -10);
               }
            };

            JTextField text = new JTextField("text") {
               public Point getToolTipLocation(MouseEvent e) {
                  System.out.println("textfield tool tip");
                  // Move tool tip to above field
                  return new Point(getWidth()/2, -10);
               }
            };

            combo.setToolTipText("Combo Tool Tip");
            text.setToolTipText("Text Tool Tip");
            add(combo);
            add(text);
         }}

      bugCombo()
      {
         addWindowListener(new WindowAdapter() {
            public void windowClosing(WindowEvent ev) {
               dispose();
               System.exit(0);
            }});

         getContentPane().add(new P(), BorderLayout.CENTER);
         setBounds(100, 100, 400, 100);
         setVisible(true);
      }
      public static void main(String argv[])
      {
         new bugCombo();
      }
      }


      ---------- END SOURCE ----------
      (Review ID: 178600)
      ======================================================================

            svioletsunw Scott Violet (Inactive)
            jkimsunw Jeffrey Kim (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: