[PATCH] 8088147: FXCanvas: implement custom cursors

Kevin Rushforth kevin.rushforth at oracle.com
Wed Jun 29 23:20:31 UTC 2016

Hi Alexander,

I attached the patch to the bug:


If I build it and run the manual test in "legacy" mode, meaning run 
everything with 9+109 and the legacy jfxrt.jar file, then it runs and 
the cursor now changes. So this looks like a good starting point for a fix.

I tried building and running this in Jigsaw mode (building with 
jdk-9+109, but running the tests with a more recent JDK that includes 
modularization support), and noticed two problems right away that must 
be addressed:

1. The unit tests for SWT are missing some of the jigsaw test tasks so 
the build fails right away with an exception from gradle:

    > Task with name 'jigsawTestsLinux' not found in project ':swt'.

Wiring up SWT-based tests to our unit test harness will take a bit more 
work than what you have provided (not even counting the Mac issue, which 
could be handled by excluding the test on Mac). In the short term, 
relying on manual tests for this fix might be best.

2. You have introduced a dependency on a new internal package, 
com.sun.javafx.tk. If this is required in order to implement the fix, 
then you will need to add this package to the list of packages exports 
to javafx.swt in PlatformImpl; otherwise the following exception is 
thrown at runtime:

Exception in thread "JavaFX Application Thread" 
java.lang.IllegalAccessError: class javafx.embed.swt.SWTCursors (in 
module javafx.swt) cannot access class com.sun.javafx.tk.Toolkit (in 
module javafx.graphics) because module javafx.graphics does not export 
com.sun.javafx.tk to module javafx.swt

I won't have time to sponsor this change until the second half of July, 
but if others have time, the review can proceed and I'll pick it back up 
then if it is in good enough shape to run.

-- Kevin

Kevin Rushforth wrote:
> Hi Alexander,
> It looks like your patch was stripped out by the mailing list server.
> Can you please send me the patch offline, as a zip file (so line 
> endings are preserved across different systems), and I will unzip it 
> and attach it to the bug report.
> -- Kevin
> Alexander Nyssen wrote:
>> Hi,
>> I have worked on a first contribution related to JDK-8088147. 
>> Attached please find a patch (created in extended Git format) that 
>> comprises the related changes. I have augmented the implementation of 
>> javafx.embed.swt.SWTCursors to handle the image cursor case. I 
>> further adjusted javafx.scene.Scene to update the cursor frame (in 
>> addition to the cursor) within synchronizeSceneProperties, so the 
>> cursor is not cleared in the first pulse succeeding the cursor 
>> property change.
>> I have added an automated JUnit test (SWTCursorsTest) to the swt 
>> module, as well as a manual test (SWTImageCursorTest) to the 
>> systemTests module, with which the proper behavior can be verified. 
>> As no tests for SWT existed so far, I updated the build.gradle and 
>> gradle.properties files to support an SWT_TEST option, which allows 
>> to handle them similar to Swing tests. I also added the respective 
>> SWT dependency to the systemTests module. Please note that the JUnit 
>> test can currently not be executed using Gradle on the Mac (where the 
>> manual test currently is the single option; the automated tests are 
>> disabled), because there SWT-based tests require the 
>> -XstartOnFirstThread option that is currently not supported by the 
>> Gradle test runner (see https://issues.gradle.org/browse/GRADLE-3290 
>> for details). We would have to use an ant task as a workaround.
>> Regards,
>> Alexander

More information about the openjfx-dev mailing list