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

getToolTipText(MouseEvent event) of JComboBox is never called

XMLWordPrintable

      Name: yyT116575 Date: 02/19/2001


      java version "1.3.0"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0-C)
      Java HotSpot(TM) Client VM (build 1.3.0-C, mixed mode)

      Start the JDialog1 class below. In order to see the tool-tip take the
      mouse and point to the JComboBox. You'll see the Text "hallo otto".
      This is wrong. Since the combo box overrides the
      getToolTipText(MouseEvent event) method of JComponent, the text "juhu"
      returned by this method should be returned.

      source code:

      import java.awt.*;
      import javax.swing.*;
      import java.awt.event.MouseEvent;

      public class JDialog1 extends javax.swing.JDialog {
        public JDialog1(Frame parent) {
          super(parent);

          getContentPane().setLayout(null);
          setSize(405,305);
          setVisible(false);

          JComboBox1.setToolTipText("hallo otto");
          getContentPane().add(JComboBox1);
          JComboBox1.setBounds(96,72,240,36);
        }

        public JDialog1() {
          this((Frame)null);
        }

        public JDialog1(String sTitle) {
          this();
          setTitle(sTitle);
        }

        public void setVisible(boolean b) {
          if (b) {
            setLocation(50, 50);
          }
          super.setVisible(b);
        }

        static public void main(String args[]) {
          (new JDialog1()).setVisible(true);
        }

        javax.swing.JComboBox JComboBox1 = new javax.swing.JComboBox(
          new Object[]{"rot", "gr?n", "blau"} ) {
            public String getToolTipText(MouseEvent event) {
              return "juhu";
            }
          };

      }
      (Review ID: 117252)
      ======================================================================

            alexp Alexander Potochkin (Inactive)
            yyoungsunw Yung-ching Young (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: