Index: trunk/src/org/openstreetmap/josm/gui/ExtendedDialog.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/ExtendedDialog.java	(revision 3710)
+++ trunk/src/org/openstreetmap/josm/gui/ExtendedDialog.java	(revision 3711)
@@ -71,5 +71,5 @@
     private List<Integer> cancelButtonIdx = Collections.emptyList();
     private int defaultButtonIdx = 1;
-    private JButton defaultButton = null;
+    protected JButton defaultButton = null;
     private Icon icon;
     private boolean modal;
Index: trunk/src/org/openstreetmap/josm/tools/Utils.java
===================================================================
--- trunk/src/org/openstreetmap/josm/tools/Utils.java	(revision 3710)
+++ trunk/src/org/openstreetmap/josm/tools/Utils.java	(revision 3711)
@@ -27,3 +27,17 @@
         }
     }
+
+    /**
+     * return the modulus in the range [0, n)
+     */
+    public static int mod(int a, int n) {
+        if (n <= 0)
+            throw new IllegalArgumentException();
+        int res = a % n;
+        if (res < 0) {
+            res += n;
+        }
+        return res;
+    }
+
 }
