Index: src/org/openstreetmap/josm/gui/MapView.java
===================================================================
--- src/org/openstreetmap/josm/gui/MapView.java	(revision 2077)
+++ src/org/openstreetmap/josm/gui/MapView.java	(working copy)
@@ -370,6 +370,9 @@
         double lat = b.min.lat();
         double lon = b.min.lon();
 
+        int w = offscreenBuffer.getWidth();
+        int h = offscreenBuffer.getHeight();
+
         Point p = getPoint(b.min);
         path.moveTo(p.x, p.y);
 
@@ -377,30 +380,53 @@
         for(; lat <= max; lat += 1.0)
         {
             p = getPoint(new LatLon(lat >= max ? max : lat, lon));
-            path.lineTo(p.x, p.y);
+            // OpenJDK has problems when it should draw out of bounds
+            // This ensures lineTo only draws into the visible area
+            if(p.x < 0 || p.y > h) {
+                path.moveTo(p.x, Math.min(p.y, h));
+            } else {
+                path.lineTo(p.x, Math.max(p.y, 0));
+
+            }
         }
         lat = max; max = b.max.lon();
         for(; lon <= max; lon += 1.0)
         {
             p = getPoint(new LatLon(lat, lon >= max ? max : lon));
-            path.lineTo(p.x, p.y);
+            // OpenJDK...
+            if(p.y < 0 || p.x < 0) {
+                path.moveTo(Math.max(p.x, 0), p.y);
+            } else {
+                path.lineTo(Math.min(p.x, w), p.y);
+            }
         }
         lon = max; max = b.min.lat();
         for(; lat >= max; lat -= 1.0)
         {
             p = getPoint(new LatLon(lat <= max ? max : lat, lon));
-            path.lineTo(p.x, p.y);
+            // OpenJDK...
+            if(p.x > w || p.y < 0) {
+                path.moveTo(p.x, Math.max(p.y, 0));
+            } else {
+                path.lineTo(p.x, Math.min(p.y, h));
+            }
         }
         lat = max; max = b.min.lon();
         for(; lon >= max; lon -= 1.0)
         {
             p = getPoint(new LatLon(lat, lon <= max ? max : lon));
-            path.lineTo(p.x, p.y);
+            // OpenJDK...
+            if(p.y > h || p.x > w) {
+                path.moveTo(Math.min(p.x, w), p.y);
+            } else {
+                path.lineTo(Math.max(p.x, 0), p.y);
+            }
         }
 
         if (playHeadMarker != null) {
             playHeadMarker.paint(tempG, this);
         }
+
         tempG.draw(path);
 
         g.drawImage(offscreenBuffer, 0, 0, null);
