<AWT Dev> Toolkit.createCustomCursor throws exceptions

Mario Torre neugens.limasoftware at gmail.com
Wed Apr 20 18:54:47 UTC 2016


2016-04-20 20:32 GMT+02:00 Sergey Bylokhov <Sergey.Bylokhov at oracle.com>:
> Hi, Mario.
>>
>> BTW, Toolkit.createCustomCursor  doesn't say to throw anything upon
>> failure, I would expect user code to check getBestCursorSize before
>> calling createCustomCursor, but this seems to never be done in the
>> internal code, and I don't know if we can fix this since it would be a
>> behaviour difference, perhaps some people rely on this exception.
>>
>> Any ideas or suggestions?
>
>
> Probably Toolkit.createCustomCursor() should check that the custom cursors
> are supported and getBestCursorSize() return non-empty size. If the
> getBestCursorSize() returns the empty size then createCustomCursor()
> should/could return Cursor.DEFAULT_CURSOR(or empty transparent cursor). And
> this default cursor will be used in DragSource.

Yes, this was my first idea, but I realised that some application may
not expect that and instead rely on the exception, although this is
very unlikely.

In the environment where this is failing it turns out that the video
driver doesn't support hardware cursors, but reverting to software
cursors "fixes" the problem.

I will propose a solution based on checking getBestCursorSize as soon
as I get back to my work machine (where I have the code laying
around), so we can see from there how better to proceed.

Cheers,
Mario
-- 
pgp key: http://subkeys.pgp.net/ PGP Key ID: 80F240CF
Fingerprint: BA39 9666 94EC 8B73 27FA  FC7C 4086 63E3 80F2 40CF

Java Champion - Blog: http://neugens.wordpress.com - Twitter: @neugens
Proud GNU Classpath developer: http://www.classpath.org/
OpenJDK: http://openjdk.java.net/projects/caciocavallo/

Please, support open standards:
http://endsoftpatents.org/


More information about the awt-dev mailing list