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

mouseClicked event not received during pressing a (Char)-Key on Solaris

XMLWordPrintable

    • 05
    • sparc
    • solaris_8



        Name: rmT116609 Date: 10/17/2001


        java version "1.3.1_01"
        Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.1_01)
        Java HotSpot(TM) Client VM (build 1.3.1_01, mixed mode)


        There is a diffent event-behaviour between Solaris and Windows under the
        following circumstances:

        I have a MouseListener and a KeyListener (see Example).
        -Press a (char)-key on the keyboard
        -hold this key down
        -click with the mouse into the frame

        Windows output:
        mousePressed
        mouseReleased
        mouseClicked


        Solaris output:
        mousePressed
        mouseReleased
        (NO mouseClicked ! - this is a bug I think)

        Without pressing a key there is the same behaviour on
        both Solaris and Windows:

        Windows output:
        mousePressed
        mouseReleased
        mouseClicked


        Solaris output:
        mousePressed
        mouseReleased
        mouseClicked

        I would expect a mouseClicked-event also in the first case. I need this within
        a graphical application for a combined Pan/Zoom(In/Out) functionality to control
        Zoom In and Zoom Out in combination with a mouse-click and I have to
        differentiate between a mousePressed-mouseDragged-mouseReleased
        -sequence, so it is nessecary to get the CLICK.

        The problem is also reproducible on Solaris 2.8 using JDK1.4.0-beta2.

        Please see the simplified example below:


        ////////////////////////////////////////////////////////////////////////

        Example:

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



        public class KeyMouseTest implements KeyListener, MouseListener
        {
         public static void main(String[] args)
         {
         JFrame f = new JFrame("KeyMouseTest");

         KeyMouseTest kt = new KeyMouseTest();

         f.addKeyListener(kt);
         f.addMouseListener(kt);

         f.setSize(new Dimension(320, 200));;
         f.show();
         }



        ////////////////////////////////////////////////////////

         public void keyPressed(KeyEvent e)
         {
          //System.out.println("keyPressed");
         }
         
         public void keyReleased(KeyEvent e)
         {
          //System.out.println("keyReleased ");
         }

         public void keyTyped(KeyEvent e)
         {
          //System.out.println("keyTyped");
         }


        ///////////////////////////////////////////////

         public void mousePressed(MouseEvent e)
         {
          System.out.println("mousePressed");
         }

         public void mouseReleased(MouseEvent e)
         {
          System.out.println("mouseReleased");
         }

         public void mouseClicked(MouseEvent e)
         {
          System.out.println("mouseClicked");
         }

         public void mouseEntered(MouseEvent e)
         {
         // System.out.println("mouseEntered");
         }

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

        }

        ///////////////////////////////////////////////
        (Review ID: 133910)
        ======================================================================

              bchristi Brent Christian
              rmandalasunw Ranjith Mandala (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: