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

Alexandr Scherbatiy alexandr.scherbatiy at oracle.com
Wed Dec 2 08:25:49 UTC 2015


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
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/swing-dev/attachments/20151202/5757a0aa/attachment.html>


More information about the swing-dev mailing list