RFR: 8200224: Multiple press event when JFXPanel gains focus

Florian Kirmaier github.com+6547435+FlorianKirmaier at openjdk.org
Tue Oct 29 11:27:35 UTC 2019


Original PR: https://github.com/javafxports/openjdk-jfx/pull/591

A side effect of JDK-8200224 is, that the first click on a JFXPanel is always a double click.
The cause for JDK-8200224 is the fix for JDK-8087914 (Clicking on Menu in JFXPanel ignored if another swing component has focus).
This fix introduced synthesized press-events, which is an unsafe fix for the problem.

The pull request introduces a new fix for the problem.
Instead of simulating new input-events, we set JavaFX Scene/Window to focused.
We do so, by using setFocused.
When the original Swing-Focus event is called slightly later, it won't have any side-effects,
because calling setFocused just sets the value of a boolean property.

I've now also added a unit-test for the problem.

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

Commits:
 - 314e423c: JDK-8200224
 - 725e5fef: JDK-8200224

Changes: https://git.openjdk.java.net/jfx/pull/25/files
 Webrev: https://webrevs.openjdk.java.net/jfx/25/webrev.00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8200224
  Stats: 140 lines in 2 files changed: 133 ins; 2 del; 5 mod
  Patch: https://git.openjdk.java.net/jfx/pull/25.diff
  Fetch: git fetch https://git.openjdk.java.net/jfx pull/25/head:pull/25

PR: https://git.openjdk.java.net/jfx/pull/25


More information about the openjfx-dev mailing list