RFR: 8237505: RadioMenuItem in ToggleGroup: deselected on accelerator

Michael Strauß mstrauss at openjdk.org
Sat Jan 21 23:02:13 UTC 2023


On Fri, 20 Jan 2023 19:06:32 GMT, Andy Goryachev <angorya at openjdk.org> wrote:

>> No check was present in `RadioMenuItem` accelerator to see if it is in a `ToggleGroup` or not.
>> 
>> Made changes to check if `RadioMenuItem` is part of `ToggleGroup` or not. If it is part of a `ToggleGroup`, then it can not be cleared using accelerator.
>> 
>> Added test to validate the change.
>
> modules/javafx.controls/src/main/java/com/sun/javafx/scene/control/ControlAcceleratorSupport.java line 178:
> 
>> 176:                         if (!menuitem.isDisable()) {
>> 177:                             if (menuitem instanceof RadioMenuItem) {
>> 178:                                 if(((RadioMenuItem)menuitem).getToggleGroup() == null){
> 
> minor: this group insists on adding spaces after "if" and before "{"

You can use a pattern variable here to get rid of all the casts.

-------------

PR: https://git.openjdk.org/jfx/pull/1002


More information about the openjfx-dev mailing list