<Swing Dev> RFR: 8249548: backward focus traversal gets stuck in button group

Pankaj Bansal pankaj.b.bansal at oracle.com
Sun Aug 30 15:57:06 UTC 2020


Hello Phil,

Thanks for looking at this.


On 29/08/20 12:07 AM, Philip Race wrote:
> The protected method I see in BasicRadioButtonUI was added for
> 8033699: Incorrect radio button behavior
> In JDK7u and had no CCC  / CSR that I can find and the change was made 
> in an update release
> So I don't think we need a CSR to remove it again.
>
I also saw that same method was added in AquaButtonRadioUI under 
JDK-8208640 in JDK11 and there is no CSR filled for that either. So I 
will be pushing this change without the CSR.

Regards,
Pankaj

> -phil.
>
> On 8/21/20, 8:03 PM, Sergey Bylokhov wrote:
>> Looks fine.
>>
>> I am not sure, do we need to file CSR for removing protected methods 
>> in the subclass or not, please double-check.
>>
>> On 26.07.2020 03:54, Pankaj Bansal wrote:
>>> Hi All,
>>>
>>> Please review the following fix for jdk16.
>>>
>>> Bug : https://bugs.openjdk.java.net/browse/JDK-8249548
>>> webrev: http://cr.openjdk.java.net/~pbansal/8249548/webrev00/ 
>>> <http://cr.openjdk.java.net/%7Epbansal/8249548/webrev00/>
>>>
>>> Issue: If few ToggleButtons are added to button group, the backward 
>>> focus traversal can get stuck in few scenarios while using 
>>> LayoutFocusTraversalPolicy. For exaple, if a TextField is added to a 
>>> frame and a Button Group is added with two buttons and the second 
>>> button in set selected, we can not move the focus from Button Group 
>>> to Text Field using "Shift+Tab". More details in JBS.
>>>
>>> Cause: The LayoutFocusTraversalPolicy uses 
>>> SortingFocusTraversalPolicy always selects first button for focus 
>>> traversal in button group for Toggle Button. This can be changed by 
>>> Component if one of the button in the button group is set selected. 
>>> This results in the selected Button being selected again and again 
>>> for selection on pressing "Shift+Tab". This results in focus being 
>>> stuck at same position. This is a generic issue and it is observed 
>>> in all L&F for JToggleButton.
>>>
>>> The JRadioButton does not have this issue as BasicRadioButtonUI and 
>>> AquaRadioButtonUI have code to handle this issue but the Synth L&F 
>>> has this issue for JRadioButton also. So, this issue can be observed 
>>> in both ToggleButton and RadioButton in nimbus L&F.
>>>
>>> Fix: The fix is to add the code to handle this in BasicButtonUI 
>>> class, so that it is available for all L&F without copying it in 
>>> different L&F classes. The focus traversal works fine after this 
>>> change for all L&F for both ToggleButton and RadioButton. Along with 
>>> the current problem, this fix is also fixes issue like we cant 
>>> change the selected button and focus in ToggleButton group like 
>>> RadioButton group.
>>>
>>> An automated test is added. I have ran the Mach5 with all tests and 
>>> this is not causing any failures. Links in JBS.
>>>
>>>
>>> Regards
>>> Pankaj
>>>
>>
>>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.java.net/pipermail/swing-dev/attachments/20200830/5c99b484/attachment.htm>


More information about the swing-dev mailing list