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

Philip Race philip.race at oracle.com
Fri Aug 28 18:37:15 UTC 2020


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.

-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
>>
>
>


More information about the swing-dev mailing list