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

Right mouse button can generate ActionEvents

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 1.4.1
    • 1.2.0, 1.3.0
    • client-libs
    • hopper
    • x86
    • windows_nt
    • Verified



      Name: nt126004 Date: 08/09/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)

      On a JButton, press the left mouse button and, without releasing it, click the
      right button. This (incorrectly) fires an ActionEvent and disarms the button.

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

      class BTest extends JFrame
      {
      private JButton btn;

      public BTest()
      {
      super("Button Test");

      btn = new JButton("Click Me!!!");

      btn.addActionListener(new ActionListener()
      {
      public void actionPerformed(ActionEvent e)
      {
      System.out.println("Action performed!");

      return;
      }
      });

      setBounds(0, 0, 150, 100);
      btn.setBounds(25, 25, 100, 25);

      getContentPane().setLayout(null);
      getContentPane().add(btn);

      setVisible(true);

      return;
      }

      public static void main(String args[])
      {
      new BTest();

      return;
      }
      }
      (Review ID: 129696)
      ======================================================================

            shickeysunw Shannon Hickey (Inactive)
            nthompsosunw Nathanael Thompson (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: