JDK-6895894 : On IE7, JButton is disarmed when pressed while other window is active
  • Type: Bug
  • Component: deploy
  • Sub-Component: plugin
  • Affected Version: 5.0u17
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • OS: windows_vista
  • CPU: x86
  • Submitted: 2009-10-28
  • Updated: 2010-12-15
  • Resolved: 2009-12-23
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other Other Other Other Other JDK 6 JDK 7
5.0u16-crevFixed 5.0u17-crevFixed 5.0u23-rev b02Fixed 5.0u24-revFixed 5.0u25Fixed 6-poolResolved 7Resolved
Related Reports
Relates :  
Description
Vista SP2, IE7, 1.5.0_17

A JButton on an applet running in IE7 does not invoke action intermittently if other window
is active. 

With a simple applet, I can duplicate symptom.  If I count the # of actionPerformed() call count,
sometimes JButton click is not counted if I activate other window, e.g. explorer before the
click.

This does not happen with FireFox, Safari or Chrome browser.

On IE, it looks like focusLost() is called in such case and the button becomes disarmed state.

Comments
SUGGESTED FIX Also a fix for CR 6711682 can be considered as a fix for this bug. However this fix causes a side effect/regression. See CR (will be filled soon)
15-06-2010

SUGGESTED FIX Since this is a temporary fix which corrects a result rather than a real root cause we decided to introduce a secret switch to trigger the fix with Java runtime parameter: -Dfix6895894=true The fix doesn't allow javax.swing.plaf.basic.BasicButtonListener.focusLost() to run: ButtonModel model = b.getModel(); model.setArmed(false); model.setPressed(false); when mouse button is still pressed. webrev: http://jpsesvr.sfbay.sun.com:8080/ctetools/html/ViewDetail.jsp?index=3267
21-12-2009

EVALUATION The problem is because of interaction between java.awt.event.FocusEvent (FOCUS_GAINED and FOCUS_LOST) processing and java.awt.event.MouseEvent (MOUSE_PRESSED and MOUSE_RELEASED) processing. To process MouseEvent event dispatching thread (EDT) uses javax.swing.plaf.basic.BasicButtonListener.mousePressed() and javax.swing.plaf.basic.BasicButtonListener.mouseReleased() To process FocusEvent EDT uses javax.swing.plaf.basic.BasicButtonListener.focusLost() and javax.swing.plaf.basic.BasicButtonListener.focusGained() When FocusEvent is processed after MOUSE_PRESSED but before MOUSE_RELEASED it depresses and disarms buttons so MOUSE_RELEASED event processing doesn't recognize pressed buttons and as a result actionPerformed() doesn't get executed.
19-11-2009