<Swing Dev> Review request for JDK-8075084 JOptionPane.showMessageDialog causes JScrollBar to move
Rajeev Chamyal
rajeev.chamyal at oracle.com
Thu Dec 3 08:08:16 UTC 2015
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.
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: HYPERLINK "http://cr.openjdk.java.net/%7Erchamyal/8075084/webrev.00/"http://cr.openjdk.java.net/~rchamyal/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/20151203/2f938592/attachment.html>
More information about the swing-dev
mailing list