RFR: 8337246: SpinnerSkin does not consume ENTER KeyEvent when editor ActionEvent is consumed [v2]

John Hendrikx jhendrikx at openjdk.org
Fri Nov 8 03:50:48 UTC 2024


On Fri, 8 Nov 2024 00:39:34 GMT, Martin Fox <mfox at openjdk.org> wrote:

>> John Hendrikx has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Change default button tests to use non-editable spinner
>
> modules/javafx.controls/src/main/java/javafx/scene/control/skin/SpinnerSkin.java line 193:
> 
>> 191:             // on arrow keys, moving the cursor unexpectedly.
>> 192:             if (!e.isConsumed() && control.isEditable()) {
>> 193:                 Event event = textField.getEventDispatcher().dispatchEvent(e.copyFor(textField, textField), new EventDispatchChainImpl());
> 
> It would be cleaner to use the exiting `EventUtil.fireEvent()` routine.

The purpose of doing it this way is to prevent a full dispatch chain (starting from Window/Scene) to be built.  `EventUtil.fireEvent` does something else.  Perhaps a utility method is warranted if this pattern becomes commonplace to solve these kinds of issues.

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

PR Review Comment: https://git.openjdk.org/jfx/pull/1629#discussion_r1833658093


More information about the openjfx-dev mailing list