JDK-6369054 : JButton is quickly clicked.
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 1.4.2
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: windows_xp
  • CPU: x86
  • Submitted: 2006-01-05
  • Updated: 2011-02-16
  • Resolved: 2006-01-09
Related Reports
Duplicate :  
Description
FULL PRODUCT VERSION :
java version "1.5.0_06"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05)
Java HotSpot(TM) Client VM (build 1.5.0_06-b05, mixed mode, sharing)

ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows XP Professional Version 2002 ServicePack 1

A DESCRIPTION OF THE PROBLEM :
For instance, two buttons are prepared. If the mouse click and the space key are combined when depressing the buttons, the button clicked by the space bar remains depressed.

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. Use the space bar to click jButton1 - Keep the space bar depressed
2. With the mouse click the jButton2
3. It can be noticed that jButton1 is in a depressed state.


REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------

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

public class Frame1 extends JFrame {

	private static void createAndShowGUI() {
        Frame1 frame = new Frame1();
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		JTextField tf = new JTextField("Hello There");
        frame.getContentPane().add(tf);
		frame.pack();
		frame.setSize(200,200);
        frame.setVisible(true);
    }

    public static void main(String[] args) {
                createAndShowGUI();
    }

  JPanel contentPane;
  JButton jButton1 = new JButton();
  JButton jButton2 = new JButton();

  public Frame1() {
    enableEvents(AWTEvent.WINDOW_EVENT_MASK);
    try {
      jbInit();
    }
    catch(Exception e) {
      e.printStackTrace();
    }
  }

  private void jbInit() throws Exception  {
    contentPane = (JPanel) this.getContentPane();
    this.setSize(new Dimension(400, 300));
    this.setTitle("???? ????");
    jButton1.setBounds(new Rectangle(152, 61, 111, 57));
    jButton1.setText("jButton1");
    jButton1.addActionListener(new Frame1_jButton1_actionAdapter(this));
    jButton2.setText("jButton2");
    jButton2.addActionListener(new Frame1_jButton2_actionAdapter(this));
    jButton2.setBounds(new Rectangle(157, 142, 111, 57));
    contentPane.setLayout(null);
    contentPane.add(jButton1, null);
    contentPane.add(jButton2, null);
  }

  protected void processWindowEvent(WindowEvent e) {
    super.processWindowEvent(e);
    if (e.getID() == WindowEvent.WINDOW_CLOSING) {
      System.exit(0);
    }
  }

  void jButton1_actionPerformed(ActionEvent e) {

  }

  void jButton2_actionPerformed(ActionEvent e) {

  }
}

class Frame1_jButton1_actionAdapter implements 
java.awt.event.ActionListener {
  Frame1 adaptee;

  Frame1_jButton1_actionAdapter(Frame1 adaptee) {
    this.adaptee = adaptee;
  }
  public void actionPerformed(ActionEvent e) {
    adaptee.jButton1_actionPerformed(e);
  }
}

class Frame1_jButton2_actionAdapter implements 
java.awt.event.ActionListener {
  Frame1 adaptee;

  Frame1_jButton2_actionAdapter(Frame1 adaptee) {
    this.adaptee = adaptee;
  }
  public void actionPerformed(ActionEvent e) {
    adaptee.jButton2_actionPerformed(e);
  }
}

---------- END SOURCE ----------

Comments
EVALUATION I'm considering this a duplicate of 4368790 since the issues are very close and should be fixed together.
09-01-2006