[prev in list] [next in list] [prev in thread] [next in thread] 

List:       openjdk-2d-dev
Subject:    Re: RFR: 6817009: Action.SELECTED_KEY not toggled when using key binding
From:       Andrey Turbanov <aturbanov () openjdk ! org>
Date:       2023-01-31 6:55:57
Message-ID: WoMZy2rfrAQkUSqdcMlAsBahGE0kqkprGRInpuVeNpY=.ffef5b9d-252e-4c70-ab46-4694bcc897f6 () github ! com
[Download RAW message or body]

On Fri, 27 Jan 2023 10:26:10 GMT, Prasanta Sadhukhan <psadhukhan@openjdk.org> wrote:

> When the Action.SELECTED_KEY property action is assigned to ToggleButton and an \
> accelerator key binding is mapped to the action, then pressing the accelerator key \
> binding does not toggle the toggle button. This is because \
> SwingUtilities.notifyAction does not fire itemStateChanged event for such action \
> related to SELECTED_KEY. Fix is to get the Action.SELECTED_KEY command/action and \
> fire itemStateChanged Event via JToggleButton.setSelected() call to notify \
> propertyChange listener of the toggled property.

test/jdk/javax/swing/JToggleButton/TestSelectedKey.java line 96:

> 94:         action.addPropertyChangeListener(new PropertyChangeListener() {
> 95:             public void propertyChange(PropertyChangeEvent evt) {
> 96:                 if(Action.SELECTED_KEY.equals(evt.getPropertyName())) {

Suggestion:

                if (Action.SELECTED_KEY.equals(evt.getPropertyName())) {

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

PR: https://git.openjdk.org/jdk/pull/12253


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic