<Swing Dev> RFR: 8229856 [macos] Opening a menu on a JTextField can clear the text selection

Prasanta Sadhukhan prasanta.sadhukhan at oracle.com
Wed Apr 22 08:29:49 UTC 2020


Hi Tejpal,

Does it need to be triple click of any button or only left mouse button? 
If only left, then it needs to be checked?

Also, I guess the test can be automated by calling robot to do 3 clicks 
and then calling JTextField.getSelectedText() to see if the text is 
still selected or not.

Regards
Prasanta
On 22-Apr-20 12:12 PM, Tejpal Rebari wrote:
>
> Hi All,
>
> Please review the following fix for jdk15.
>
> Bug : https://bugs.openjdk.java.net/browse/JDK-8229856
>
> Webrev : http://cr.openjdk.java.net/~trebari/swing/8229856/webrev00/
>
> Issue : This issue exists in AquaLookandFeel only.
>
> The issue is that while opening a menu on a JTextFeild using 
> control-click over a selection
>
>  that has been created by triple clicking  clears the existing text 
> selection.
>
> AquaCaret.mousePressed disables the behaviour of 
> shouldHandleRelease instance variable of DefaultCaret
>
> on a popup trigger event , so the shouldHandleRelease retains its 
> previous value.
>
> If the previous value of shouldHandleRelease is true then 
> DefaultCaret.mouseRelease will clear the selection.
>
> The third click consume the mouseEvent and sets the 
> shouldHandleRelease to true.
>
> To fix this issue we should not call super.MousePressed from 
> AquaCaret on a triple click event.
>
> Test : Tested on Mac OS X.
>
> Thanks and regards
>
> Tejpal
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.java.net/pipermail/swing-dev/attachments/20200422/42273345/attachment.htm>


More information about the swing-dev mailing list