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

Regression: Strange behaviour with combination of checkbox and modal dialog

XMLWordPrintable

      SYNOPSIS
      --------
      Regression: Strange behaviour with combination of checkbox and modal dialog

      OPERATING SYSTEM
      ----------------
      All.

      FULL JDK VERSION
      ----------------
      6u18 onwards. Including 6u23-b05, 6u24-b01, 7-b120.

      DESCRIPTION from LICENSEE
      -------------------------
      The testcase creates a checkbox that, when selected, triggers a modal dialog box to be displayed. From 6u18 onwards, the very act of displaying that modal dialog causes the checkbox to become deselected. With releases prior to 6u18, the checkbox remains selected, as expected.

      The problem seems to be caused by the fix for CR 6711682. We determined this by taking the BasicButtonListener class from 6u18 and using it with 6u17 by prepending it to the bootclasspath. Looking at the source, the only difference between the 6u17 and 6u18 versions of this class is the fix for 6711682, where the order of two method calls, model.setPressed() and model.setArmed(), were swapped in the BasicButtonListener.focusLost() method.

      REPRODUCTION INSTRUCTIONS
      -------------------------
      1. Compile and run the attached testcase, SwingCheckBoxDemo.java. You
         should see a small Window, with a checkbox.

      2. Click the checkbox to select it. A modal dialog will appear. With
         6u18 onwards you will also see that the checkbox gets deselected
         simultaneously, and unexpectedly.

      Thread.dumpStack() calls are added to the testcase to dump the stack whenever the state of the checkbox is changed. With 6u17 and 6u18, you see this stack trace when the box is selected:

      Checkbox selected at
      java.lang.Exception: Stack trace
              at java.lang.Thread.dumpStack(Thread.java:1206)
              at SwingCheckBoxDemo.itemStateChanged(SwingCheckBoxDemo.java:38)
              at javax.swing.AbstractButton.fireItemStateChanged(AbstractButton.java:2023)
              at javax.swing.AbstractButton$Handler.itemStateChanged(AbstractButton.java:2325)
              at javax.swing.DefaultButtonModel.fireItemStateChanged(DefaultButtonModel.java:440)
              at javax.swing.JToggleButton$ToggleButtonModel.setSelected(JToggleButton.java:255)
              at javax.swing.JToggleButton$ToggleButtonModel.setPressed(JToggleButton.java:272)
              at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:236)
              at java.awt.Component.processMouseEvent(Component.java:6263)
              at javax.swing.JComponent.processMouseEvent(JComponent.java:3267)
              at java.awt.Component.processEvent(Component.java:6028)
              at java.awt.Container.processEvent(Container.java:2041)
              at java.awt.Component.dispatchEventImpl(Component.java:4630)
              at java.awt.Container.dispatchEventImpl(Container.java:2099)
              at java.awt.Component.dispatchEvent(Component.java:4460)
              at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4574)
              at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4238)
              at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4168)
              at java.awt.Container.dispatchEventImpl(Container.java:2085)
              at java.awt.Window.dispatchEventImpl(Window.java:2478)
              at java.awt.Component.dispatchEvent(Component.java:4460)
              at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
              at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
              at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
              at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
              at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
              at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
              at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)

      With 6u18, you also see this stack trace immediately afterwards:

      Checkbox deselected at
      java.lang.Exception: Stack trace
              at java.lang.Thread.dumpStack(Thread.java:1206)
              at SwingCheckBoxDemo.itemStateChanged(SwingCheckBoxDemo.java:49)
              at javax.swing.AbstractButton.fireItemStateChanged(AbstractButton.java:2023)
              at javax.swing.AbstractButton$Handler.itemStateChanged(AbstractButton.java:2325)
              at javax.swing.DefaultButtonModel.fireItemStateChanged(DefaultButtonModel.java:440)
              at javax.swing.JToggleButton$ToggleButtonModel.setSelected(JToggleButton.java:255)
              at javax.swing.JToggleButton$ToggleButtonModel.setPressed(JToggleButton.java:272)
              at javax.swing.plaf.basic.BasicButtonListener.focusLost(BasicButtonListener.java:181)
              at java.awt.Component.processFocusEvent(Component.java:6155)
              at java.awt.Component.processEvent(Component.java:6019)
              at java.awt.Container.processEvent(Container.java:2041)
              at java.awt.Component.dispatchEventImpl(Component.java:4630)
              at java.awt.Container.dispatchEventImpl(Container.java:2099)
              at java.awt.Component.dispatchEvent(Component.java:4460)
              at java.awt.KeyboardFocusManager.redispatchEvent(KeyboardFocusManager.java:1850)
              at java.awt.DefaultKeyboardFocusManager.typeAheadAssertions(DefaultKeyboardFocusManager.java:910)
              at java.awt.DefaultKeyboardFocusManager.dispatchEvent(DefaultKeyboardFocusManager.java:568)
              at java.awt.Component.dispatchEventImpl(Component.java:4502)
              at java.awt.Container.dispatchEventImpl(Container.java:2099)
              at java.awt.Component.dispatchEvent(Component.java:4460)
              at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
              at java.awt.SentEvent.dispatch(SentEvent.java:55)
              at java.awt.DefaultKeyboardFocusManager$DefaultKeyboardFocusManagerSentEvent.dispatch(DefaultKeyboardFocusManage
      r.java:183)
              at java.awt.DefaultKeyboardFocusManager.sendMessage(DefaultKeyboardFocusManager.java:210)
              at java.awt.DefaultKeyboardFocusManager.dispatchEvent(DefaultKeyboardFocusManager.java:635)
              at java.awt.Component.dispatchEventImpl(Component.java:4502)
              at java.awt.Container.dispatchEventImpl(Container.java:2099)
              at java.awt.Window.dispatchEventImpl(Window.java:2478)
              at java.awt.Component.dispatchEvent(Component.java:4460)
              at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
              at java.awt.SequencedEvent.dispatch(SequencedEvent.java:101)
              at java.awt.EventQueue.dispatchEvent(EventQueue.java:597)
              at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
              at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
              at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:178)
              at java.awt.Dialog$1.run(Dialog.java:1046)
              at java.awt.Dialog$3.run(Dialog.java:1098)
              at java.security.AccessController.doPrivileged(Native Method)
              at java.awt.Dialog.show(Dialog.java:1096)
              at java.awt.Component.show(Component.java:1563)
              at java.awt.Component.setVisible(Component.java:1515)
              at java.awt.Window.setVisible(Window.java:842)
              at java.awt.Dialog.setVisible(Dialog.java:986)
              at SwingCheckBoxDemo.itemStateChanged(SwingCheckBoxDemo.java:44)
              at javax.swing.AbstractButton.fireItemStateChanged(AbstractButton.java:2023)
              at javax.swing.AbstractButton$Handler.itemStateChanged(AbstractButton.java:2325)
              at javax.swing.DefaultButtonModel.fireItemStateChanged(DefaultButtonModel.java:440)
              at javax.swing.JToggleButton$ToggleButtonModel.setSelected(JToggleButton.java:255)
              at javax.swing.JToggleButton$ToggleButtonModel.setPressed(JToggleButton.java:272)
              at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:236)
              at java.awt.Component.processMouseEvent(Component.java:6263)
              at javax.swing.JComponent.processMouseEvent(JComponent.java:3267)
              at java.awt.Component.processEvent(Component.java:6028)
              at java.awt.Container.processEvent(Container.java:2041)
              at java.awt.Component.dispatchEventImpl(Component.java:4630)
              at java.awt.Container.dispatchEventImpl(Container.java:2099)
              at java.awt.Component.dispatchEvent(Component.java:4460)
              at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4574)
              at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4238)
              at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4168)
              at java.awt.Container.dispatchEventImpl(Container.java:2085)
              at java.awt.Window.dispatchEventImpl(Window.java:2478)
              at java.awt.Component.dispatchEvent(Component.java:4460)
              at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
              at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
              at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
              at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
              at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
              at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
              at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)

            Unassigned Unassigned
            dkorbel David Korbel (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: