Friday, October 11, 2013

Multi-touch Gestures For JavaFX Apps Running in SWT

EclipseCon Europe 2013 I am currently preparing a demo for my talk at EclipseCon Europe 2013. Embedding my JavaFX based graphical editor into Eclipse went smoothly thanks to the FXCanvas that bridges SWT and JavaFX. But I realized that multi-touch gestures did no longer work.

I filed a bug for that, but I could not resist trying to find out what's wrong myself. You may not know that the sources of JavaFX are open now. So after cloning their mercurial repo and browsing a couple of classes I found out that SWT's GestureEvents are neither converted to JavaFX GestureEvents nor transferred to an embedded JavaFX canvas. The implementation was simply missing.

So with some help by Tom Schindl and Steve Northover (thanks a lot, guys!) I hacked a solution that works fine for me, as you can see in the screencast below. If you're interested you can download my the code from github.

No comments: