<Swing Dev> Review request for JDK-8075084 JOptionPane.showMessageDialog causes JScrollBar to move

Alexander Scherbatiy alexandr.scherbatiy at oracle.com
Mon Dec 21 23:42:50 UTC 2015


On 21/12/15 12:21, Rajeev Chamyal wrote:
> Hello Alexandr,
>
> I have updated the fix. Please review it.
> http://cr.openjdk.java.net/~rchamyal/8075084/webrev.01/

    When a modal dialog is shown does it block all windows or is it 
possible that a modal dialog blocks some windows and does not block others?

  Thanks,
  Alexandr.

>
> Regards,
> Rajeev Chamyal
>
> -----Original Message-----
> From: Alexander Scherbatiy
> Sent: 10 December 2015 16:59
> To: Rajeev Chamyal
> Cc: Sergey Bylokhov; Prasanta Sadhukhan; swing-dev at openjdk.java.net
> Subject: Re: Review request for JDK-8075084 JOptionPane.showMessageDialog causes JScrollBar to move
>
> On 12/3/2015 11:08 AM, Rajeev Chamyal wrote:
>> Hello Alexandr,
>>
>> Thanks for the review.
>>
>> When we open a JOption dialog from AdjustmentListener the scroll bar
>> arrow button is not receiving the mouse release event.
>>
>> As a result the JScrollBar: scrollTimer is not getting stopped and its
>> becoming a recursive call.
>>
>      I tried to run the BuggyDialog sample form the issue description with the suggested fix.
>      I noticed a strange behavior when I press scroll down and click not on the JOptionPane OK button but on the close button.
>      The scroll bar continues scrolling in this case.
>
>      When a modal dialog is open it blocks others windows. Is it possible to check this event and stop the scroll timer in this case?
>
>     Thanks,
>     Alexandr.
>
>> Regards,
>>
>> Rajeev Chamyal
>>
>> *From:*Alexandr Scherbatiy
>> *Sent:* 02 December 2015 13:56
>> *To:* Rajeev Chamyal; Sergey Bylokhov; Prasanta Sadhukhan;
>> swing-dev at openjdk.java.net
>> *Subject:* Re: Review request for JDK-8075084
>> JOptionPane.showMessageDialog causes JScrollBar to move
>>
>> On 11/11/2015 7:47 AM, Rajeev Chamyal wrote:
>>
>>      Hello All,
>>
>>      Please review the following fix for Jdk9:
>>
>>        
>>
>>      Bug:https://bugs.openjdk.java.net/browse/JDK-8075084
>>
>>      Webrev:http://cr.openjdk.java.net/~rchamyal/8075084/webrev.00/
>>      <http://cr.openjdk.java.net/%7Erchamyal/8075084/webrev.00/>
>>
>>      Issue: On running the sample program attached in bug JDK-8075084
>>      user is expected to see a scrollbar and on clicking the scrollbar
>>      tracker or scrollbar up/down arrow buttons a JOption dialog should
>>      come once. The program works fine if scrollbar tracker is clicked
>>      i.e. JOption dialog comes only once. But on clicking up/down arrow
>>      buttons of scrollbar the JOption dialog keeps on coming repeatedly.
>>
>>      Cause: The mouse pressed event of scrollbar arrow buttons calls BasicScrollBarUI::scrollByUnit method which creates a property change event and calls scroll bar action listener which again calls BasicScrollBarUI::scrollByUnit. This is becoming a recursive call and causing the scrollbar slider to move repeatedly till it reaches the other end of scrollbar.
>>
>>     If I change the AdjustmentListener to not show the JOptionPane it
>> is called only one time.
>>     What is the reason that showing JOptionPane causes that the
>> AdjustmentListener is called one more time?
>>
>>     Thanks,
>>     Alexandr.
>>
>>
>>        
>>
>>      Fix: Added checks in the BasicScrollBarUI action listener to stop the recursion.
>>
>>        
>>
>>      Regards,
>>
>>      Rajeev Chamyal
>>




More information about the swing-dev mailing list