<AWT Dev> Toolkit.createCustomCursor throws exceptions

Sergey Bylokhov Sergey.Bylokhov at oracle.com
Wed Apr 20 18:32:09 UTC 2016


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.

>
> I would like to approach a possible solution for JDK 8 as well as 9,
> so an 8 compatible fix would be ideal.
>
> Cheers,
> Mario
>


-- 
Best regards, Sergey.


More information about the awt-dev mailing list