Index: trunk/src/org/openstreetmap/josm/tools/ImageProvider.java
===================================================================
--- trunk/src/org/openstreetmap/josm/tools/ImageProvider.java	(revision 16981)
+++ trunk/src/org/openstreetmap/josm/tools/ImageProvider.java	(revision 16984)
@@ -48,4 +48,5 @@
 import java.util.concurrent.Executors;
 import java.util.function.Consumer;
+import java.util.function.UnaryOperator;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
@@ -1331,5 +1332,5 @@
 
         Point hotSpot = new Point();
-        Image image = getCursorImage(name, overlay, hotSpot);
+        Image image = getCursorImage(name, overlay, dim -> Toolkit.getDefaultToolkit().getBestCursorSize(dim.width, dim.height), hotSpot);
 
         return Toolkit.getDefaultToolkit().createCustomCursor(image, hotSpot, name);
@@ -1348,8 +1349,9 @@
      * @param name the cursor image filename in "cursor" directory
      * @param overlay optional overlay image
+     * @param bestCursorSizeFunction computes the best cursor size, see {@link Toolkit#getBestCursorSize(int, int)}
      * @param hotSpot will be set to the properly scaled hotspot of the cursor
      * @return cursor with a given file name, optionally decorated with an overlay image
      */
-    static Image getCursorImage(String name, String overlay, /* out */ Point hotSpot) {
+    static Image getCursorImage(String name, String overlay, UnaryOperator<Dimension> bestCursorSizeFunction, /* out */ Point hotSpot) {
         ImageProvider imageProvider = new ImageProvider("cursor", name);
         if (overlay != null) {
@@ -1366,5 +1368,5 @@
         // AWT will resize the cursor to bestCursorSize internally anyway, but miss to scale the hotspot as well
         // (bug JDK-8238734).  So let's do this ourselves, and also scale the hotspot accordingly.
-        Dimension bestCursorSize = Toolkit.getDefaultToolkit().getBestCursorSize(width, height);
+        Dimension bestCursorSize = bestCursorSizeFunction.apply(new Dimension(width, height));
         if (bestCursorSize.width != 0 && bestCursorSize.height != 0) {
             // In principle, we could pass the MultiResolutionImage itself to AWT, but due to bug JDK-8240568,
