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

Mouse listener for the JComboBox doesn't detect mouse events

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P2 P2
    • None
    • 1.2.0
    • client-libs



      Name: vi73552 Date: 03/30/99


      1. When the code below is running, the JComboBox doesn't detect
      when the mouse entering and exiting it:
      When the mouse pointer entering(exiting) the area of the JComboBox
      I cannot see the message "ComboBox Entering..." and ComboBox Exiting...
      import java.awt.*;
      import java.awt.event.*;
      import java.applet.*;
      import java.util.Vector;
      import javax.swing.*;

      public class Test
      {

        public Test()
        {
           JFrame f = new JFrame("Deposit Dialog");
          JPanel entryPanel = new JPanel(); // for user input
          JComboBox labelBox = new JComboBox();
          JButton okButton = new JButton("Ok");
          f.setSize(320,400);

          Container fc = f.getContentPane();
          fc.setLayout(new GridBagLayout());

          entryPanel.add(new JLabel("Label:"));
          entryPanel.add(labelBox);
          entryPanel.add(okButton);

          labelBox.setEditable(true);
          labelBox.addItem("vug");
          fc.add(entryPanel);

          f.setVisible(true);
          MouseListener mfListener = new MouseAdapter() {
            public void mouseEntered(MouseEvent e) {
      System.out.println("Frame Entering...");
            }

           public void mouseExited(MouseEvent e) {
             System.out.println("Frame Exiting...");
            }
          };

          MouseListener mBListener = new MouseAdapter() {
            public void mouseEntered(MouseEvent e) {
      System.out.println("Button Entering...");
            }

           public void mouseExited(MouseEvent e) {
             System.out.println("Button Exiting...");
            }
          };

          MouseListener mcbListener = new MouseAdapter() {
            public void mouseEntered(MouseEvent e) {
      System.out.println("ComboBox Entering...");
            }

           public void mouseExited(MouseEvent e) {
             System.out.println("ComboBox Exiting...");
            }
          };

          f.addMouseListener(mfListener);
          labelBox.addMouseListener(mcbListener);
          okButton.addMouseListener(mBListener);
          /*
          */

        }

      public static void main(String args[])
      {
        Test test = new Test();
      }

      } // class

      =================
      java -version gives
      Classic VM <build JDK-1.2-V, native threads, symcjit>
      javs -fullvesrion:
      java full vesrion "JDK-1.2-V"
      (Review ID: 56278)
      ======================================================================

            tsantossunw Tom Santos (Inactive)
            vasya Vassili Igouchkine (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: