<Swing Dev> [10][JDK-8075084] JOptionPane.showMessageDialog causes JScrollBar to move

classic Classic list List threaded Threaded
12 messages Options
Reply | Threaded
Open this post in threaded view
|

<Swing Dev> [10][JDK-8075084] JOptionPane.showMessageDialog causes JScrollBar to move

Krishna Addepalli

Hi All,

 

Please review the fix for bug:

 

Bug: JDK- 8075084  https://bugs.openjdk.java.net/browse/JDK-8075084

 

JDK 10 Webrev : http://cr.openjdk.java.net/~psadhukhan/8075084/webrev00/

 

Summary:

This is an interesting test case written by Drew Jetter (http://webbugs.us.oracle.com/IMWeb/incidentReportView.do?incidentID=2688093). The test shows a vertical scroll bar, and whenever the user clicks on the arrow buttons, it pops up a message dialog. The moment user clicks on “OK” button, the movement of the scrollbar doesnot stop, and it keeps showing up the dialog box again and again, while also moving the scroll bar till it reaches the end.

 

This issue has already been root-caused here : http://mail.openjdk.java.net/pipermail/swing-dev/2016-November/006938.html , just reiterating here again:

 

The problem is that once a Modal dialog is shown on top of the scrollbar, it loses focus, and hence doesnot get the mouse release event (which is swallowed by the DialogBox). For the mouse press event, the scrollbar would have started a timer, which keeps firing and generating the move events, which is why the slider moves repeatedly.

 

Proposed fix is, once the scroll bar has moved by unit distance, check if it is still in focus, and only then start the timer. Otherwise *do not* start the timer, and also set the button press to false.

 

PS: This could be a design decision as well, since the use case is not that common for scrollbar to lose focus on mouse press, so I decided to check out the behavior in Qt 5.9.1, and found that it too behaves the same way. Of course it’s not binding that Java should behave the same way as Qt, but it was interesting to know that Qt also had similar behavior.

 

Thanks,

Krishna

 

 

Reply | Threaded
Open this post in threaded view
|

Re: <Swing Dev> [10][JDK-8075084] JOptionPane.showMessageDialog causes JScrollBar to move

Krishna Addepalli

Hi Sergey,

 

Can we have the fix pushed in, as per our conversation?

 

Thanks,

Krishna

 

From: Krishna Addepalli
Sent: Wednesday, July 26, 2017 3:07 PM
To: [hidden email]
Cc: Prasanta Sadhukhan <[hidden email]>; Sergey Bylokhov <[hidden email]>
Subject: [10][JDK-8075084] JOptionPane.showMessageDialog causes JScrollBar to move

 

Hi All,

 

Please review the fix for bug:

 

Bug: JDK- 8075084  https://bugs.openjdk.java.net/browse/JDK-8075084

 

JDK 10 Webrev : http://cr.openjdk.java.net/~psadhukhan/8075084/webrev00/

 

Summary:

This is an interesting test case written by Drew Jetter (http://webbugs.us.oracle.com/IMWeb/incidentReportView.do?incidentID=2688093). The test shows a vertical scroll bar, and whenever the user clicks on the arrow buttons, it pops up a message dialog. The moment user clicks on “OK” button, the movement of the scrollbar doesnot stop, and it keeps showing up the dialog box again and again, while also moving the scroll bar till it reaches the end.

 

This issue has already been root-caused here : http://mail.openjdk.java.net/pipermail/swing-dev/2016-November/006938.html , just reiterating here again:

 

The problem is that once a Modal dialog is shown on top of the scrollbar, it loses focus, and hence doesnot get the mouse release event (which is swallowed by the DialogBox). For the mouse press event, the scrollbar would have started a timer, which keeps firing and generating the move events, which is why the slider moves repeatedly.

 

Proposed fix is, once the scroll bar has moved by unit distance, check if it is still in focus, and only then start the timer. Otherwise *do not* start the timer, and also set the button press to false.

 

PS: This could be a design decision as well, since the use case is not that common for scrollbar to lose focus on mouse press, so I decided to check out the behavior in Qt 5.9.1, and found that it too behaves the same way. Of course it’s not binding that Java should behave the same way as Qt, but it was interesting to know that Qt also had similar behavior.

 

Thanks,

Krishna

 

 

Reply | Threaded
Open this post in threaded view
|

Re: <Swing Dev> [10][JDK-8075084] JOptionPane.showMessageDialog causes JScrollBar to move

Sergey Bylokhov
In reply to this post by Krishna Addepalli
Hi, Krishna.
Did you found a reason why the bug is not always reproducible(for other top level windows)?

----- [hidden email] wrote:
>
>
>

Hi Sergey,

 

Can we have the fix pushed in, as per our conversation?

 

Thanks,

Krishna

 

>

From: Krishna Addepalli
> Sent: Wednesday, July 26, 2017 3:07 PM
> To: [hidden email]
> Cc: Prasanta Sadhukhan <[hidden email]>; Sergey Bylokhov <[hidden email]>
> Subject: [10][JDK-8075084] JOptionPane.showMessageDialog causes JScrollBar to move

 

Hi All,

 

Please review the fix for bug:

 

Bug: JDK- 8075084  https://bugs.openjdk.java.net/browse/JDK-8075084

 

JDK 10 Webrev : http://cr.openjdk.java.net/~psadhukhan/8075084/webrev00/

 

Summary:

This is an interesting test case written by Drew Jetter (http://webbugs.us.oracle.com/IMWeb/incidentReportView.do?incidentID=2688093). The test shows a vertical scroll bar, and whenever the user clicks on the arrow buttons, it pops up a message dialog. The moment user clicks on “OK” button, the movement of the scrollbar doesnot stop, and it keeps showing up the dialog box again and again, while also moving the scroll bar till it reaches the end.

 

This issue has already been root-caused here : http://mail.openjdk.java.net/pipermail/swing-dev/2016-November/006938.html , just reiterating here again:

 

The problem is that once a Modal dialog is shown on top of the scrollbar, it loses focus, and hence doesnot get the mouse release event (which is swallowed by the DialogBox). For the mouse press event, the scrollbar would have started a timer, which keeps firing and generating the move events, which is why the slider moves repeatedly.

 

Proposed fix is, once the scroll bar has moved by unit distance, check if it is still in focus, and only then start the timer. Otherwise *do not* start the timer, and also set the button press to false.

 

PS: This could be a design decision as well, since the use case is not that common for scrollbar to lose focus on mouse press, so I decided to check out the behavior in Qt 5.9.1, and found that it too behaves the same way. Of course it’s not binding that Java should behave the same way as Qt, but it was interesting to know that Qt also had similar behavior.

 

Thanks,

Krishna

 

 

Reply | Threaded
Open this post in threaded view
|

Re: <Swing Dev> [10][JDK-8075084] JOptionPane.showMessageDialog causes JScrollBar to move

Jason Mehrens
In reply to this post by Krishna Addepalli
Related bug: http://mail.openjdk.java.net/pipermail/swing-dev/2014-April/003394.html

________________________________________
From: swing-dev <[hidden email]> on behalf of Krishna Addepalli <[hidden email]>
Sent: Tuesday, August 29, 2017 3:17 AM
To: [hidden email]
Subject: Re: <Swing Dev> [10][JDK-8075084] JOptionPane.showMessageDialog causes JScrollBar to move

Hi Sergey,

Can we have the fix pushed in, as per our conversation?

Thanks,
Krishna

From: Krishna Addepalli
Sent: Wednesday, July 26, 2017 3:07 PM
To: [hidden email]
Cc: Prasanta Sadhukhan <[hidden email]>; Sergey Bylokhov <[hidden email]>
Subject: [10][JDK-8075084] JOptionPane.showMessageDialog causes JScrollBar to move

Hi All,

Please review the fix for bug:

Bug: JDK- 8075084  https://bugs.openjdk.java.net/browse/JDK-8075084

JDK 10 Webrev : http://cr.openjdk.java.net/~psadhukhan/8075084/webrev00/

Summary:
This is an interesting test case written by Drew Jetter (http://webbugs.us.oracle.com/IMWeb/incidentReportView.do?incidentID=2688093). The test shows a vertical scroll bar, and whenever the user clicks on the arrow buttons, it pops up a message dialog. The moment user clicks on “OK” button, the movement of the scrollbar doesnot stop, and it keeps showing up the dialog box again and again, while also moving the scroll bar till it reaches the end.

This issue has already been root-caused here : http://mail.openjdk.java.net/pipermail/swing-dev/2016-November/006938.html , just reiterating here again:

The problem is that once a Modal dialog is shown on top of the scrollbar, it loses focus, and hence doesnot get the mouse release event (which is swallowed by the DialogBox). For the mouse press event, the scrollbar would have started a timer, which keeps firing and generating the move events, which is why the slider moves repeatedly.

Proposed fix is, once the scroll bar has moved by unit distance, check if it is still in focus, and only then start the timer. Otherwise *do not* start the timer, and also set the button press to false.

PS: This could be a design decision as well, since the use case is not that common for scrollbar to lose focus on mouse press, so I decided to check out the behavior in Qt 5.9.1, and found that it too behaves the same way. Of course it’s not binding that Java should behave the same way as Qt, but it was interesting to know that Qt also had similar behavior.

Thanks,
Krishna


Reply | Threaded
Open this post in threaded view
|

Re: <Swing Dev> [10][JDK-8075084] JOptionPane.showMessageDialog causes JScrollBar to move

Krishna Addepalli
Hi Sergey,

I have recreated the webrev for JDK-10 consolidated repo:

http://cr.openjdk.java.net/~kaddepalli/8075084/webrev01/

Please review and let me know your comments.

Thanks,
Krishna

-----Original Message-----
From: Jason Mehrens [mailto:[hidden email]]
Sent: Wednesday, August 30, 2017 7:54 PM
To: Krishna Addepalli <[hidden email]>; [hidden email]
Subject: Re: <Swing Dev> [10][JDK-8075084] JOptionPane.showMessageDialog causes JScrollBar to move

Related bug: http://mail.openjdk.java.net/pipermail/swing-dev/2014-April/003394.html

________________________________________
From: swing-dev <[hidden email]> on behalf of Krishna Addepalli <[hidden email]>
Sent: Tuesday, August 29, 2017 3:17 AM
To: [hidden email]
Subject: Re: <Swing Dev> [10][JDK-8075084] JOptionPane.showMessageDialog causes JScrollBar to move

Hi Sergey,

Can we have the fix pushed in, as per our conversation?

Thanks,
Krishna

From: Krishna Addepalli
Sent: Wednesday, July 26, 2017 3:07 PM
To: [hidden email]
Cc: Prasanta Sadhukhan <[hidden email]>; Sergey Bylokhov <[hidden email]>
Subject: [10][JDK-8075084] JOptionPane.showMessageDialog causes JScrollBar to move

Hi All,

Please review the fix for bug:

Bug: JDK- 8075084  https://bugs.openjdk.java.net/browse/JDK-8075084

JDK 10 Webrev : http://cr.openjdk.java.net/~psadhukhan/8075084/webrev00/

Summary:
This is an interesting test case written by Drew Jetter (http://webbugs.us.oracle.com/IMWeb/incidentReportView.do?incidentID=2688093). The test shows a vertical scroll bar, and whenever the user clicks on the arrow buttons, it pops up a message dialog. The moment user clicks on "OK" button, the movement of the scrollbar doesnot stop, and it keeps showing up the dialog box again and again, while also moving the scroll bar till it reaches the end.

This issue has already been root-caused here : http://mail.openjdk.java.net/pipermail/swing-dev/2016-November/006938.html , just reiterating here again:

The problem is that once a Modal dialog is shown on top of the scrollbar, it loses focus, and hence doesnot get the mouse release event (which is swallowed by the DialogBox). For the mouse press event, the scrollbar would have started a timer, which keeps firing and generating the move events, which is why the slider moves repeatedly.

Proposed fix is, once the scroll bar has moved by unit distance, check if it is still in focus, and only then start the timer. Otherwise *do not* start the timer, and also set the button press to false.

PS: This could be a design decision as well, since the use case is not that common for scrollbar to lose focus on mouse press, so I decided to check out the behavior in Qt 5.9.1, and found that it too behaves the same way. Of course it's not binding that Java should behave the same way as Qt, but it was interesting to know that Qt also had similar behavior.

Thanks,
Krishna


Reply | Threaded
Open this post in threaded view
|

Re: <Swing Dev> [10][JDK-8075084] JOptionPane.showMessageDialog causes JScrollBar to move

Krishna Addepalli
Any update on this Sergey?

-----Original Message-----
From: Krishna Addepalli
Sent: Thursday, October 26, 2017 2:13 PM
To: [hidden email]; Sergey Bylokhov <[hidden email]>
Subject: RE: <Swing Dev> [10][JDK-8075084] JOptionPane.showMessageDialog causes JScrollBar to move

Hi Sergey,

I have recreated the webrev for JDK-10 consolidated repo:

http://cr.openjdk.java.net/~kaddepalli/8075084/webrev01/

Please review and let me know your comments.

Thanks,
Krishna

-----Original Message-----
From: Jason Mehrens [mailto:[hidden email]]
Sent: Wednesday, August 30, 2017 7:54 PM
To: Krishna Addepalli <[hidden email]>; [hidden email]
Subject: Re: <Swing Dev> [10][JDK-8075084] JOptionPane.showMessageDialog causes JScrollBar to move

Related bug: http://mail.openjdk.java.net/pipermail/swing-dev/2014-April/003394.html

________________________________________
From: swing-dev <[hidden email]> on behalf of Krishna Addepalli <[hidden email]>
Sent: Tuesday, August 29, 2017 3:17 AM
To: [hidden email]
Subject: Re: <Swing Dev> [10][JDK-8075084] JOptionPane.showMessageDialog causes JScrollBar to move

Hi Sergey,

Can we have the fix pushed in, as per our conversation?

Thanks,
Krishna

From: Krishna Addepalli
Sent: Wednesday, July 26, 2017 3:07 PM
To: [hidden email]
Cc: Prasanta Sadhukhan <[hidden email]>; Sergey Bylokhov <[hidden email]>
Subject: [10][JDK-8075084] JOptionPane.showMessageDialog causes JScrollBar to move

Hi All,

Please review the fix for bug:

Bug: JDK- 8075084  https://bugs.openjdk.java.net/browse/JDK-8075084

JDK 10 Webrev : http://cr.openjdk.java.net/~psadhukhan/8075084/webrev00/

Summary:
This is an interesting test case written by Drew Jetter (http://webbugs.us.oracle.com/IMWeb/incidentReportView.do?incidentID=2688093). The test shows a vertical scroll bar, and whenever the user clicks on the arrow buttons, it pops up a message dialog. The moment user clicks on "OK" button, the movement of the scrollbar doesnot stop, and it keeps showing up the dialog box again and again, while also moving the scroll bar till it reaches the end.

This issue has already been root-caused here : http://mail.openjdk.java.net/pipermail/swing-dev/2016-November/006938.html , just reiterating here again:

The problem is that once a Modal dialog is shown on top of the scrollbar, it loses focus, and hence doesnot get the mouse release event (which is swallowed by the DialogBox). For the mouse press event, the scrollbar would have started a timer, which keeps firing and generating the move events, which is why the slider moves repeatedly.

Proposed fix is, once the scroll bar has moved by unit distance, check if it is still in focus, and only then start the timer. Otherwise *do not* start the timer, and also set the button press to false.

PS: This could be a design decision as well, since the use case is not that common for scrollbar to lose focus on mouse press, so I decided to check out the behavior in Qt 5.9.1, and found that it too behaves the same way. Of course it's not binding that Java should behave the same way as Qt, but it was interesting to know that Qt also had similar behavior.

Thanks,
Krishna


Reply | Threaded
Open this post in threaded view
|

Re: <Swing Dev> [10][JDK-8075084] JOptionPane.showMessageDialog causes JScrollBar to move

semyon.sadetsky
This fix was already published on Swing alias:

http://mail.openjdk.java.net/pipermail/swing-dev/2016-October/006808.html

Please continue your discussions in the original thread.

--Semyon


On 11/08/2017 06:51 AM, Krishna Addepalli wrote:

> Any update on this Sergey?
>
> -----Original Message-----
> From: Krishna Addepalli
> Sent: Thursday, October 26, 2017 2:13 PM
> To: [hidden email]; Sergey Bylokhov <[hidden email]>
> Subject: RE: <Swing Dev> [10][JDK-8075084] JOptionPane.showMessageDialog causes JScrollBar to move
>
> Hi Sergey,
>
> I have recreated the webrev for JDK-10 consolidated repo:
>
> http://cr.openjdk.java.net/~kaddepalli/8075084/webrev01/
>
> Please review and let me know your comments.
>
> Thanks,
> Krishna
>
> -----Original Message-----
> From: Jason Mehrens [mailto:[hidden email]]
> Sent: Wednesday, August 30, 2017 7:54 PM
> To: Krishna Addepalli <[hidden email]>; [hidden email]
> Subject: Re: <Swing Dev> [10][JDK-8075084] JOptionPane.showMessageDialog causes JScrollBar to move
>
> Related bug: http://mail.openjdk.java.net/pipermail/swing-dev/2014-April/003394.html
>
> ________________________________________
> From: swing-dev <[hidden email]> on behalf of Krishna Addepalli <[hidden email]>
> Sent: Tuesday, August 29, 2017 3:17 AM
> To: [hidden email]
> Subject: Re: <Swing Dev> [10][JDK-8075084] JOptionPane.showMessageDialog causes JScrollBar to move
>
> Hi Sergey,
>
> Can we have the fix pushed in, as per our conversation?
>
> Thanks,
> Krishna
>
> From: Krishna Addepalli
> Sent: Wednesday, July 26, 2017 3:07 PM
> To: [hidden email]
> Cc: Prasanta Sadhukhan <[hidden email]>; Sergey Bylokhov <[hidden email]>
> Subject: [10][JDK-8075084] JOptionPane.showMessageDialog causes JScrollBar to move
>
> Hi All,
>
> Please review the fix for bug:
>
> Bug: JDK- 8075084  https://bugs.openjdk.java.net/browse/JDK-8075084
>
> JDK 10 Webrev : http://cr.openjdk.java.net/~psadhukhan/8075084/webrev00/
>
> Summary:
> This is an interesting test case written by Drew Jetter (http://webbugs.us.oracle.com/IMWeb/incidentReportView.do?incidentID=2688093). The test shows a vertical scroll bar, and whenever the user clicks on the arrow buttons, it pops up a message dialog. The moment user clicks on "OK" button, the movement of the scrollbar doesnot stop, and it keeps showing up the dialog box again and again, while also moving the scroll bar till it reaches the end.
>
> This issue has already been root-caused here : http://mail.openjdk.java.net/pipermail/swing-dev/2016-November/006938.html , just reiterating here again:
>
> The problem is that once a Modal dialog is shown on top of the scrollbar, it loses focus, and hence doesnot get the mouse release event (which is swallowed by the DialogBox). For the mouse press event, the scrollbar would have started a timer, which keeps firing and generating the move events, which is why the slider moves repeatedly.
>
> Proposed fix is, once the scroll bar has moved by unit distance, check if it is still in focus, and only then start the timer. Otherwise *do not* start the timer, and also set the button press to false.
>
> PS: This could be a design decision as well, since the use case is not that common for scrollbar to lose focus on mouse press, so I decided to check out the behavior in Qt 5.9.1, and found that it too behaves the same way. Of course it's not binding that Java should behave the same way as Qt, but it was interesting to know that Qt also had similar behavior.
>
> Thanks,
> Krishna
>
>

Reply | Threaded
Open this post in threaded view
|

Re: <Swing Dev> [10][JDK-8075084] JOptionPane.showMessageDialog causes JScrollBar to move

Krishna Addepalli
Hi Semyon,

There has already been extensive analysis about this, in the original thread. I'll loop you in that conversation, so that you could suggest the way ahead.

Thanks,
Krishna

-----Original Message-----
From: Semyon Sadetsky
Sent: Wednesday, November 8, 2017 11:25 PM
To: Krishna Addepalli <[hidden email]>; [hidden email]; Sergey Bylokhov <[hidden email]>
Subject: Re: <Swing Dev> [10][JDK-8075084] JOptionPane.showMessageDialog causes JScrollBar to move

This fix was already published on Swing alias:

http://mail.openjdk.java.net/pipermail/swing-dev/2016-October/006808.html

Please continue your discussions in the original thread.

--Semyon


On 11/08/2017 06:51 AM, Krishna Addepalli wrote:

> Any update on this Sergey?
>
> -----Original Message-----
> From: Krishna Addepalli
> Sent: Thursday, October 26, 2017 2:13 PM
> To: [hidden email]; Sergey Bylokhov <[hidden email]>
> Subject: RE: <Swing Dev> [10][JDK-8075084] JOptionPane.showMessageDialog causes JScrollBar to move
>
> Hi Sergey,
>
> I have recreated the webrev for JDK-10 consolidated repo:
>
> http://cr.openjdk.java.net/~kaddepalli/8075084/webrev01/
>
> Please review and let me know your comments.
>
> Thanks,
> Krishna
>
> -----Original Message-----
> From: Jason Mehrens [mailto:[hidden email]]
> Sent: Wednesday, August 30, 2017 7:54 PM
> To: Krishna Addepalli <[hidden email]>; [hidden email]
> Subject: Re: <Swing Dev> [10][JDK-8075084] JOptionPane.showMessageDialog causes JScrollBar to move
>
> Related bug: http://mail.openjdk.java.net/pipermail/swing-dev/2014-April/003394.html
>
> ________________________________________
> From: swing-dev <[hidden email]> on behalf of Krishna Addepalli <[hidden email]>
> Sent: Tuesday, August 29, 2017 3:17 AM
> To: [hidden email]
> Subject: Re: <Swing Dev> [10][JDK-8075084] JOptionPane.showMessageDialog causes JScrollBar to move
>
> Hi Sergey,
>
> Can we have the fix pushed in, as per our conversation?
>
> Thanks,
> Krishna
>
> From: Krishna Addepalli
> Sent: Wednesday, July 26, 2017 3:07 PM
> To: [hidden email]
> Cc: Prasanta Sadhukhan <[hidden email]>; Sergey Bylokhov <[hidden email]>
> Subject: [10][JDK-8075084] JOptionPane.showMessageDialog causes JScrollBar to move
>
> Hi All,
>
> Please review the fix for bug:
>
> Bug: JDK- 8075084  https://bugs.openjdk.java.net/browse/JDK-8075084
>
> JDK 10 Webrev : http://cr.openjdk.java.net/~psadhukhan/8075084/webrev00/
>
> Summary:
> This is an interesting test case written by Drew Jetter (http://webbugs.us.oracle.com/IMWeb/incidentReportView.do?incidentID=2688093). The test shows a vertical scroll bar, and whenever the user clicks on the arrow buttons, it pops up a message dialog. The moment user clicks on "OK" button, the movement of the scrollbar doesnot stop, and it keeps showing up the dialog box again and again, while also moving the scroll bar till it reaches the end.
>
> This issue has already been root-caused here : http://mail.openjdk.java.net/pipermail/swing-dev/2016-November/006938.html , just reiterating here again:
>
> The problem is that once a Modal dialog is shown on top of the scrollbar, it loses focus, and hence doesnot get the mouse release event (which is swallowed by the DialogBox). For the mouse press event, the scrollbar would have started a timer, which keeps firing and generating the move events, which is why the slider moves repeatedly.
>
> Proposed fix is, once the scroll bar has moved by unit distance, check if it is still in focus, and only then start the timer. Otherwise *do not* start the timer, and also set the button press to false.
>
> PS: This could be a design decision as well, since the use case is not that common for scrollbar to lose focus on mouse press, so I decided to check out the behavior in Qt 5.9.1, and found that it too behaves the same way. Of course it's not binding that Java should behave the same way as Qt, but it was interesting to know that Qt also had similar behavior.
>
> Thanks,
> Krishna
>
>

Reply | Threaded
Open this post in threaded view
|

Re: <Swing Dev> [10][JDK-8075084] JOptionPane.showMessageDialog causes JScrollBar to move

Sergey Bylokhov
Hi, Krishna.
Last time in the discussion we had a question why it is not possible to
reproduce the bug using JFrame and focus manipulation in the same way as
"JOptionPane.showMessageDialog" works. Did you check why it works in one
case and does not work in another?

On 12/11/2017 22:41, Krishna Addepalli wrote:

> Hi Semyon,
>
> There has already been extensive analysis about this, in the original thread. I'll loop you in that conversation, so that you could suggest the way ahead.
>
> Thanks,
> Krishna
>
> -----Original Message-----
> From: Semyon Sadetsky
> Sent: Wednesday, November 8, 2017 11:25 PM
> To: Krishna Addepalli <[hidden email]>; [hidden email]; Sergey Bylokhov <[hidden email]>
> Subject: Re: <Swing Dev> [10][JDK-8075084] JOptionPane.showMessageDialog causes JScrollBar to move
>
> This fix was already published on Swing alias:
>
> http://mail.openjdk.java.net/pipermail/swing-dev/2016-October/006808.html
>
> Please continue your discussions in the original thread.
>
> --Semyon
>
>
> On 11/08/2017 06:51 AM, Krishna Addepalli wrote:
>> Any update on this Sergey?
>>
>> -----Original Message-----
>> From: Krishna Addepalli
>> Sent: Thursday, October 26, 2017 2:13 PM
>> To: [hidden email]; Sergey Bylokhov <[hidden email]>
>> Subject: RE: <Swing Dev> [10][JDK-8075084] JOptionPane.showMessageDialog causes JScrollBar to move
>>
>> Hi Sergey,
>>
>> I have recreated the webrev for JDK-10 consolidated repo:
>>
>> http://cr.openjdk.java.net/~kaddepalli/8075084/webrev01/
>>
>> Please review and let me know your comments.
>>
>> Thanks,
>> Krishna
>>
>> -----Original Message-----
>> From: Jason Mehrens [mailto:[hidden email]]
>> Sent: Wednesday, August 30, 2017 7:54 PM
>> To: Krishna Addepalli <[hidden email]>; [hidden email]
>> Subject: Re: <Swing Dev> [10][JDK-8075084] JOptionPane.showMessageDialog causes JScrollBar to move
>>
>> Related bug: http://mail.openjdk.java.net/pipermail/swing-dev/2014-April/003394.html
>>
>> ________________________________________
>> From: swing-dev <[hidden email]> on behalf of Krishna Addepalli <[hidden email]>
>> Sent: Tuesday, August 29, 2017 3:17 AM
>> To: [hidden email]
>> Subject: Re: <Swing Dev> [10][JDK-8075084] JOptionPane.showMessageDialog causes JScrollBar to move
>>
>> Hi Sergey,
>>
>> Can we have the fix pushed in, as per our conversation?
>>
>> Thanks,
>> Krishna
>>
>> From: Krishna Addepalli
>> Sent: Wednesday, July 26, 2017 3:07 PM
>> To: [hidden email]
>> Cc: Prasanta Sadhukhan <[hidden email]>; Sergey Bylokhov <[hidden email]>
>> Subject: [10][JDK-8075084] JOptionPane.showMessageDialog causes JScrollBar to move
>>
>> Hi All,
>>
>> Please review the fix for bug:
>>
>> Bug: JDK- 8075084  https://bugs.openjdk.java.net/browse/JDK-8075084
>>
>> JDK 10 Webrev : http://cr.openjdk.java.net/~psadhukhan/8075084/webrev00/
>>
>> Summary:
>> This is an interesting test case written by Drew Jetter (http://webbugs.us.oracle.com/IMWeb/incidentReportView.do?incidentID=2688093). The test shows a vertical scroll bar, and whenever the user clicks on the arrow buttons, it pops up a message dialog. The moment user clicks on "OK" button, the movement of the scrollbar doesnot stop, and it keeps showing up the dialog box again and again, while also moving the scroll bar till it reaches the end.
>>
>> This issue has already been root-caused here : http://mail.openjdk.java.net/pipermail/swing-dev/2016-November/006938.html , just reiterating here again:
>>
>> The problem is that once a Modal dialog is shown on top of the scrollbar, it loses focus, and hence doesnot get the mouse release event (which is swallowed by the DialogBox). For the mouse press event, the scrollbar would have started a timer, which keeps firing and generating the move events, which is why the slider moves repeatedly.
>>
>> Proposed fix is, once the scroll bar has moved by unit distance, check if it is still in focus, and only then start the timer. Otherwise *do not* start the timer, and also set the button press to false.
>>
>> PS: This could be a design decision as well, since the use case is not that common for scrollbar to lose focus on mouse press, so I decided to check out the behavior in Qt 5.9.1, and found that it too behaves the same way. Of course it's not binding that Java should behave the same way as Qt, but it was interesting to know that Qt also had similar behavior.
>>
>> Thanks,
>> Krishna
>>
>>
>


--
Best regards, Sergey.
Reply | Threaded
Open this post in threaded view
|

Re: <Swing Dev> [10][JDK-8075084] JOptionPane.showMessageDialog causes JScrollBar to move

Krishna Addepalli
Hi Sergey,
I have tried to create a testcase (attached again for your reference), which showcases the problem.
Below is the code that tries to reproduce the problem:
        JFrame frame = new JFrame("Test");
        frame.setAlwaysOnTop(true);
        Rectangle bds = this.getBounds();
        frame.setBounds(bds.x + 30, bds.y + 30, bds.width, bds.height);
        frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
        frame.setModalExclusionType(ModalExclusionType.APPLICATION_EXCLUDE);
        frame.setVisible(true);

//        JOptionPane.showMessageDialog(this, "Testing");

If I uncomment the JOptionPane.showMessageDialog, the focus event is provided to the newly created modal dialog, and the bug is reproduced, whereas when I use JFrame, the bug is not reproducible.
Could you point me where to dig further from here?

Thanks,
Krishna

-----Original Message-----
From: Sergey Bylokhov
Sent: Wednesday, November 15, 2017 4:18 AM
To: Krishna Addepalli <[hidden email]>; Semyon Sadetsky <[hidden email]>; [hidden email]
Subject: Re: <Swing Dev> [10][JDK-8075084] JOptionPane.showMessageDialog causes JScrollBar to move

Hi, Krishna.
Last time in the discussion we had a question why it is not possible to reproduce the bug using JFrame and focus manipulation in the same way as "JOptionPane.showMessageDialog" works. Did you check why it works in one case and does not work in another?

On 12/11/2017 22:41, Krishna Addepalli wrote:

> Hi Semyon,
>
> There has already been extensive analysis about this, in the original thread. I'll loop you in that conversation, so that you could suggest the way ahead.
>
> Thanks,
> Krishna
>
> -----Original Message-----
> From: Semyon Sadetsky
> Sent: Wednesday, November 8, 2017 11:25 PM
> To: Krishna Addepalli <[hidden email]>;
> [hidden email]; Sergey Bylokhov
> <[hidden email]>
> Subject: Re: <Swing Dev> [10][JDK-8075084]
> JOptionPane.showMessageDialog causes JScrollBar to move
>
> This fix was already published on Swing alias:
>
> http://mail.openjdk.java.net/pipermail/swing-dev/2016-October/006808.h
> tml
>
> Please continue your discussions in the original thread.
>
> --Semyon
>
>
> On 11/08/2017 06:51 AM, Krishna Addepalli wrote:
>> Any update on this Sergey?
>>
>> -----Original Message-----
>> From: Krishna Addepalli
>> Sent: Thursday, October 26, 2017 2:13 PM
>> To: [hidden email]; Sergey Bylokhov
>> <[hidden email]>
>> Subject: RE: <Swing Dev> [10][JDK-8075084]
>> JOptionPane.showMessageDialog causes JScrollBar to move
>>
>> Hi Sergey,
>>
>> I have recreated the webrev for JDK-10 consolidated repo:
>>
>> http://cr.openjdk.java.net/~kaddepalli/8075084/webrev01/
>>
>> Please review and let me know your comments.
>>
>> Thanks,
>> Krishna
>>
>> -----Original Message-----
>> From: Jason Mehrens [mailto:[hidden email]]
>> Sent: Wednesday, August 30, 2017 7:54 PM
>> To: Krishna Addepalli <[hidden email]>;
>> [hidden email]
>> Subject: Re: <Swing Dev> [10][JDK-8075084]
>> JOptionPane.showMessageDialog causes JScrollBar to move
>>
>> Related bug:
>> http://mail.openjdk.java.net/pipermail/swing-dev/2014-April/003394.ht
>> ml
>>
>> ________________________________________
>> From: swing-dev <[hidden email]> on behalf of
>> Krishna Addepalli <[hidden email]>
>> Sent: Tuesday, August 29, 2017 3:17 AM
>> To: [hidden email]
>> Subject: Re: <Swing Dev> [10][JDK-8075084]
>> JOptionPane.showMessageDialog causes JScrollBar to move
>>
>> Hi Sergey,
>>
>> Can we have the fix pushed in, as per our conversation?
>>
>> Thanks,
>> Krishna
>>
>> From: Krishna Addepalli
>> Sent: Wednesday, July 26, 2017 3:07 PM
>> To: [hidden email]
>> Cc: Prasanta Sadhukhan <[hidden email]>; Sergey
>> Bylokhov <[hidden email]>
>> Subject: [10][JDK-8075084] JOptionPane.showMessageDialog causes
>> JScrollBar to move
>>
>> Hi All,
>>
>> Please review the fix for bug:
>>
>> Bug: JDK- 8075084  https://bugs.openjdk.java.net/browse/JDK-8075084
>>
>> JDK 10 Webrev :
>> http://cr.openjdk.java.net/~psadhukhan/8075084/webrev00/
>>
>> Summary:
>> This is an interesting test case written by Drew Jetter (http://webbugs.us.oracle.com/IMWeb/incidentReportView.do?incidentID=2688093). The test shows a vertical scroll bar, and whenever the user clicks on the arrow buttons, it pops up a message dialog. The moment user clicks on "OK" button, the movement of the scrollbar doesnot stop, and it keeps showing up the dialog box again and again, while also moving the scroll bar till it reaches the end.
>>
>> This issue has already been root-caused here : http://mail.openjdk.java.net/pipermail/swing-dev/2016-November/006938.html , just reiterating here again:
>>
>> The problem is that once a Modal dialog is shown on top of the scrollbar, it loses focus, and hence doesnot get the mouse release event (which is swallowed by the DialogBox). For the mouse press event, the scrollbar would have started a timer, which keeps firing and generating the move events, which is why the slider moves repeatedly.
>>
>> Proposed fix is, once the scroll bar has moved by unit distance, check if it is still in focus, and only then start the timer. Otherwise *do not* start the timer, and also set the button press to false.
>>
>> PS: This could be a design decision as well, since the use case is not that common for scrollbar to lose focus on mouse press, so I decided to check out the behavior in Qt 5.9.1, and found that it too behaves the same way. Of course it's not binding that Java should behave the same way as Qt, but it was interesting to know that Qt also had similar behavior.
>>
>> Thanks,
>> Krishna
>>
>>
>

--
Best regards, Sergey.

BuggyDialog.java (3K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: <Swing Dev> [10][JDK-8075084] JOptionPane.showMessageDialog causes JScrollBar to move

Krishna Addepalli
In reply to this post by Sergey Bylokhov
Hi Sergey,

I have analyzed it further, and found a possible root cause for the difference in the behavior.
It has to do with the way the "show()" function is written for JDialog/Dialog and a JFrame.
In the case of Dialog, there is the below code which takes control of the EventQueue in its show call:

                    modalityPushed();
                    try {
                        final EventQueue eventQueue = AccessController.doPrivileged(
                                (PrivilegedAction<EventQueue>) Toolkit.getDefaultToolkit()::getSystemEventQueue);
                        secondaryLoop = eventQueue.createSecondaryLoop(() -> true, modalFilter, 0);
                        if (!secondaryLoop.enter()) {
                            secondaryLoop = null;
                        }
                    } finally {
                        modalityPopped();
                    }
Here, when the "secondaryLoop.enter()", starts, it pumps all the events to the modal Dialog, rather than the underlying window (which could be another Dialog/Frame).
For the case of JFrame, the check is only to see if it is blocked by another Dialog on top of it, but it does not stop the existing EventQueue, and start a secondaryLoop like in JDialog.

Hope this clarifies the difference in the behavioral difference between JDialog and JFrame in the testcase.

Thanks,
Krishna

-----Original Message-----
From: Sergey Bylokhov
Sent: Wednesday, November 15, 2017 4:18 AM
To: Krishna Addepalli <[hidden email]>; Semyon Sadetsky <[hidden email]>; [hidden email]
Subject: Re: <Swing Dev> [10][JDK-8075084] JOptionPane.showMessageDialog causes JScrollBar to move

Hi, Krishna.
Last time in the discussion we had a question why it is not possible to reproduce the bug using JFrame and focus manipulation in the same way as "JOptionPane.showMessageDialog" works. Did you check why it works in one case and does not work in another?

On 12/11/2017 22:41, Krishna Addepalli wrote:

> Hi Semyon,
>
> There has already been extensive analysis about this, in the original thread. I'll loop you in that conversation, so that you could suggest the way ahead.
>
> Thanks,
> Krishna
>
> -----Original Message-----
> From: Semyon Sadetsky
> Sent: Wednesday, November 8, 2017 11:25 PM
> To: Krishna Addepalli <[hidden email]>;
> [hidden email]; Sergey Bylokhov
> <[hidden email]>
> Subject: Re: <Swing Dev> [10][JDK-8075084]
> JOptionPane.showMessageDialog causes JScrollBar to move
>
> This fix was already published on Swing alias:
>
> http://mail.openjdk.java.net/pipermail/swing-dev/2016-October/006808.h
> tml
>
> Please continue your discussions in the original thread.
>
> --Semyon
>
>
> On 11/08/2017 06:51 AM, Krishna Addepalli wrote:
>> Any update on this Sergey?
>>
>> -----Original Message-----
>> From: Krishna Addepalli
>> Sent: Thursday, October 26, 2017 2:13 PM
>> To: [hidden email]; Sergey Bylokhov
>> <[hidden email]>
>> Subject: RE: <Swing Dev> [10][JDK-8075084]
>> JOptionPane.showMessageDialog causes JScrollBar to move
>>
>> Hi Sergey,
>>
>> I have recreated the webrev for JDK-10 consolidated repo:
>>
>> http://cr.openjdk.java.net/~kaddepalli/8075084/webrev01/
>>
>> Please review and let me know your comments.
>>
>> Thanks,
>> Krishna
>>
>> -----Original Message-----
>> From: Jason Mehrens [mailto:[hidden email]]
>> Sent: Wednesday, August 30, 2017 7:54 PM
>> To: Krishna Addepalli <[hidden email]>;
>> [hidden email]
>> Subject: Re: <Swing Dev> [10][JDK-8075084]
>> JOptionPane.showMessageDialog causes JScrollBar to move
>>
>> Related bug:
>> http://mail.openjdk.java.net/pipermail/swing-dev/2014-April/003394.ht
>> ml
>>
>> ________________________________________
>> From: swing-dev <[hidden email]> on behalf of
>> Krishna Addepalli <[hidden email]>
>> Sent: Tuesday, August 29, 2017 3:17 AM
>> To: [hidden email]
>> Subject: Re: <Swing Dev> [10][JDK-8075084]
>> JOptionPane.showMessageDialog causes JScrollBar to move
>>
>> Hi Sergey,
>>
>> Can we have the fix pushed in, as per our conversation?
>>
>> Thanks,
>> Krishna
>>
>> From: Krishna Addepalli
>> Sent: Wednesday, July 26, 2017 3:07 PM
>> To: [hidden email]
>> Cc: Prasanta Sadhukhan <[hidden email]>; Sergey
>> Bylokhov <[hidden email]>
>> Subject: [10][JDK-8075084] JOptionPane.showMessageDialog causes
>> JScrollBar to move
>>
>> Hi All,
>>
>> Please review the fix for bug:
>>
>> Bug: JDK- 8075084  https://bugs.openjdk.java.net/browse/JDK-8075084
>>
>> JDK 10 Webrev :
>> http://cr.openjdk.java.net/~psadhukhan/8075084/webrev00/
>>
>> Summary:
>> This is an interesting test case written by Drew Jetter (http://webbugs.us.oracle.com/IMWeb/incidentReportView.do?incidentID=2688093). The test shows a vertical scroll bar, and whenever the user clicks on the arrow buttons, it pops up a message dialog. The moment user clicks on "OK" button, the movement of the scrollbar doesnot stop, and it keeps showing up the dialog box again and again, while also moving the scroll bar till it reaches the end.
>>
>> This issue has already been root-caused here : http://mail.openjdk.java.net/pipermail/swing-dev/2016-November/006938.html , just reiterating here again:
>>
>> The problem is that once a Modal dialog is shown on top of the scrollbar, it loses focus, and hence doesnot get the mouse release event (which is swallowed by the DialogBox). For the mouse press event, the scrollbar would have started a timer, which keeps firing and generating the move events, which is why the slider moves repeatedly.
>>
>> Proposed fix is, once the scroll bar has moved by unit distance, check if it is still in focus, and only then start the timer. Otherwise *do not* start the timer, and also set the button press to false.
>>
>> PS: This could be a design decision as well, since the use case is not that common for scrollbar to lose focus on mouse press, so I decided to check out the behavior in Qt 5.9.1, and found that it too behaves the same way. Of course it's not binding that Java should behave the same way as Qt, but it was interesting to know that Qt also had similar behavior.
>>
>> Thanks,
>> Krishna
>>
>>
>


--
Best regards, Sergey.
Reply | Threaded
Open this post in threaded view
|

Re: <Swing Dev> [10][JDK-8075084] JOptionPane.showMessageDialog causes JScrollBar to move

Krishna Addepalli
Hi Sergey,

Per our conversation, I have tried to re-create the same behavior as posted in the previous mail: namely, trying to create a ModalEventFilter, and pass that to the EventDispatchThread, and then take over the events.
But, the ModalEventFilter and its base class EventFilter are internal classes, which cannot be accessed outside the awt package.
Another point is, the function "createSecondaryLoop" has two signatures, one without parameters and one that takes the EventFilter parameter.
The one without parameters is what can be created at the application level and that does not install any overriding EventFilters, so the events continue to goto the old window as well.
Whereas in the case of the ModalEventFilter, the event will be consumed by the top-level Dialog, and the underlying dialog doesnot even get the event notification.

With this in mind, I think to recreate the problem with JFrame, I guess, we need to copy the functionality of Dialog.show() into JFrame.
Let me know your thoughts on this.

Thanks,
Krishna

-----Original Message-----
From: Krishna Addepalli
Sent: Monday, November 20, 2017 5:10 PM
To: Sergey Bylokhov <[hidden email]>; Semyon Sadetsky <[hidden email]>; [hidden email]
Subject: RE: <Swing Dev> [10][JDK-8075084] JOptionPane.showMessageDialog causes JScrollBar to move

Hi Sergey,

I have analyzed it further, and found a possible root cause for the difference in the behavior.
It has to do with the way the "show()" function is written for JDialog/Dialog and a JFrame.
In the case of Dialog, there is the below code which takes control of the EventQueue in its show call:

                    modalityPushed();
                    try {
                        final EventQueue eventQueue = AccessController.doPrivileged(
                                (PrivilegedAction<EventQueue>) Toolkit.getDefaultToolkit()::getSystemEventQueue);
                        secondaryLoop = eventQueue.createSecondaryLoop(() -> true, modalFilter, 0);
                        if (!secondaryLoop.enter()) {
                            secondaryLoop = null;
                        }
                    } finally {
                        modalityPopped();
                    }
Here, when the "secondaryLoop.enter()", starts, it pumps all the events to the modal Dialog, rather than the underlying window (which could be another Dialog/Frame).
For the case of JFrame, the check is only to see if it is blocked by another Dialog on top of it, but it does not stop the existing EventQueue, and start a secondaryLoop like in JDialog.

Hope this clarifies the difference in the behavioral difference between JDialog and JFrame in the testcase.

Thanks,
Krishna

-----Original Message-----
From: Sergey Bylokhov
Sent: Wednesday, November 15, 2017 4:18 AM
To: Krishna Addepalli <[hidden email]>; Semyon Sadetsky <[hidden email]>; [hidden email]
Subject: Re: <Swing Dev> [10][JDK-8075084] JOptionPane.showMessageDialog causes JScrollBar to move

Hi, Krishna.
Last time in the discussion we had a question why it is not possible to reproduce the bug using JFrame and focus manipulation in the same way as "JOptionPane.showMessageDialog" works. Did you check why it works in one case and does not work in another?

On 12/11/2017 22:41, Krishna Addepalli wrote:

> Hi Semyon,
>
> There has already been extensive analysis about this, in the original thread. I'll loop you in that conversation, so that you could suggest the way ahead.
>
> Thanks,
> Krishna
>
> -----Original Message-----
> From: Semyon Sadetsky
> Sent: Wednesday, November 8, 2017 11:25 PM
> To: Krishna Addepalli <[hidden email]>;
> [hidden email]; Sergey Bylokhov
> <[hidden email]>
> Subject: Re: <Swing Dev> [10][JDK-8075084]
> JOptionPane.showMessageDialog causes JScrollBar to move
>
> This fix was already published on Swing alias:
>
> http://mail.openjdk.java.net/pipermail/swing-dev/2016-October/006808.h
> tml
>
> Please continue your discussions in the original thread.
>
> --Semyon
>
>
> On 11/08/2017 06:51 AM, Krishna Addepalli wrote:
>> Any update on this Sergey?
>>
>> -----Original Message-----
>> From: Krishna Addepalli
>> Sent: Thursday, October 26, 2017 2:13 PM
>> To: [hidden email]; Sergey Bylokhov
>> <[hidden email]>
>> Subject: RE: <Swing Dev> [10][JDK-8075084]
>> JOptionPane.showMessageDialog causes JScrollBar to move
>>
>> Hi Sergey,
>>
>> I have recreated the webrev for JDK-10 consolidated repo:
>>
>> http://cr.openjdk.java.net/~kaddepalli/8075084/webrev01/
>>
>> Please review and let me know your comments.
>>
>> Thanks,
>> Krishna
>>
>> -----Original Message-----
>> From: Jason Mehrens [mailto:[hidden email]]
>> Sent: Wednesday, August 30, 2017 7:54 PM
>> To: Krishna Addepalli <[hidden email]>;
>> [hidden email]
>> Subject: Re: <Swing Dev> [10][JDK-8075084]
>> JOptionPane.showMessageDialog causes JScrollBar to move
>>
>> Related bug:
>> http://mail.openjdk.java.net/pipermail/swing-dev/2014-April/003394.ht
>> ml
>>
>> ________________________________________
>> From: swing-dev <[hidden email]> on behalf of
>> Krishna Addepalli <[hidden email]>
>> Sent: Tuesday, August 29, 2017 3:17 AM
>> To: [hidden email]
>> Subject: Re: <Swing Dev> [10][JDK-8075084]
>> JOptionPane.showMessageDialog causes JScrollBar to move
>>
>> Hi Sergey,
>>
>> Can we have the fix pushed in, as per our conversation?
>>
>> Thanks,
>> Krishna
>>
>> From: Krishna Addepalli
>> Sent: Wednesday, July 26, 2017 3:07 PM
>> To: [hidden email]
>> Cc: Prasanta Sadhukhan <[hidden email]>; Sergey
>> Bylokhov <[hidden email]>
>> Subject: [10][JDK-8075084] JOptionPane.showMessageDialog causes
>> JScrollBar to move
>>
>> Hi All,
>>
>> Please review the fix for bug:
>>
>> Bug: JDK- 8075084  https://bugs.openjdk.java.net/browse/JDK-8075084
>>
>> JDK 10 Webrev :
>> http://cr.openjdk.java.net/~psadhukhan/8075084/webrev00/
>>
>> Summary:
>> This is an interesting test case written by Drew Jetter (http://webbugs.us.oracle.com/IMWeb/incidentReportView.do?incidentID=2688093). The test shows a vertical scroll bar, and whenever the user clicks on the arrow buttons, it pops up a message dialog. The moment user clicks on "OK" button, the movement of the scrollbar doesnot stop, and it keeps showing up the dialog box again and again, while also moving the scroll bar till it reaches the end.
>>
>> This issue has already been root-caused here : http://mail.openjdk.java.net/pipermail/swing-dev/2016-November/006938.html , just reiterating here again:
>>
>> The problem is that once a Modal dialog is shown on top of the scrollbar, it loses focus, and hence doesnot get the mouse release event (which is swallowed by the DialogBox). For the mouse press event, the scrollbar would have started a timer, which keeps firing and generating the move events, which is why the slider moves repeatedly.
>>
>> Proposed fix is, once the scroll bar has moved by unit distance, check if it is still in focus, and only then start the timer. Otherwise *do not* start the timer, and also set the button press to false.
>>
>> PS: This could be a design decision as well, since the use case is not that common for scrollbar to lose focus on mouse press, so I decided to check out the behavior in Qt 5.9.1, and found that it too behaves the same way. Of course it's not binding that Java should behave the same way as Qt, but it was interesting to know that Qt also had similar behavior.
>>
>> Thanks,
>> Krishna
>>
>>
>


--
Best regards, Sergey.