Index: applications/viewer/jmapviewer/src/org/openstreetmap/gui/jmapviewer/JMapViewer.java
===================================================================
--- applications/viewer/jmapviewer/src/org/openstreetmap/gui/jmapviewer/JMapViewer.java	(revision 9780)
+++ applications/viewer/jmapviewer/src/org/openstreetmap/gui/jmapviewer/JMapViewer.java	(revision 9784)
@@ -103,5 +103,5 @@
 		setLayout(null);
 		initializeZoomSlider();
-		setMinimumSize(new Dimension(Tile.WIDTH, Tile.HEIGHT));
+		setMinimumSize(new Dimension(Tile.SIZE, Tile.SIZE));
 		setPreferredSize(new Dimension(400, 400));
 		try {
@@ -302,16 +302,18 @@
 		int iMove = 0;
 
-		int tilex = center.x / Tile.WIDTH;
-		int tiley = center.y / Tile.HEIGHT;
-		int off_x = (center.x % Tile.WIDTH);
-		int off_y = (center.y % Tile.HEIGHT);
-
-		int posx = getWidth() / 2 - off_x;
-		int posy = getHeight() / 2 - off_y;
+		int tilex = center.x / Tile.SIZE;
+		int tiley = center.y / Tile.SIZE;
+		int off_x = (center.x % Tile.SIZE);
+		int off_y = (center.y % Tile.SIZE);
+
+		int w2 = getWidth() / 2;
+		int h2 = getHeight() / 2;
+		int posx = w2 - off_x;
+		int posy = h2 - off_y;
 
 		int diff_left = off_x;
-		int diff_right = Tile.WIDTH - off_x;
+		int diff_right = Tile.SIZE - off_x;
 		int diff_top = off_y;
-		int diff_bottom = Tile.HEIGHT - off_y;
+		int diff_bottom = Tile.SIZE - off_y;
 
 		boolean start_left = diff_left < diff_right;
@@ -329,6 +331,6 @@
 				iMove = 0;
 		} // calculate the visibility borders
-		int x_min = -Tile.WIDTH;
-		int y_min = -Tile.HEIGHT;
+		int x_min = -Tile.SIZE;
+		int y_min = -Tile.SIZE;
 		int x_max = getWidth();
 		int y_max = getHeight();
@@ -350,10 +352,10 @@
 							tile.paint(g, posx, posy);
 							if (tileGridVisible)
-								g.drawRect(posx, posy, Tile.WIDTH, Tile.HEIGHT);
+								g.drawRect(posx, posy, Tile.SIZE, Tile.SIZE);
 						}
 					}
 					Point p = move[iMove];
-					posx += p.x * Tile.WIDTH;
-					posy += p.y * Tile.HEIGHT;
+					posx += p.x * Tile.SIZE;
+					posy += p.y * Tile.SIZE;
 					tilex += p.x;
 					tiley += p.y;
@@ -371,4 +373,7 @@
 				marker.paint(g, p);
 		}
+		// outer border of the map
+		int mapSize = Tile.SIZE << zoom;
+		g.drawRect(w2 - center.x, h2 - center.y, mapSize, mapSize);
 	}
 
@@ -445,5 +450,5 @@
 	 *         was not found in the cache.
 	 */
-	protected Tile getTile(final int tilex, final int tiley, final int zoom) {
+	protected Tile getTile(int tilex, int tiley, int zoom) {
 		int max = (1 << zoom);
 		if (tilex < 0 || tilex >= max || tiley < 0 || tiley >= max)
Index: applications/viewer/jmapviewer/src/org/openstreetmap/gui/jmapviewer/StoppableInputStream.java
===================================================================
--- applications/viewer/jmapviewer/src/org/openstreetmap/gui/jmapviewer/StoppableInputStream.java	(revision 9780)
+++ 	(revision )
@@ -1,53 +1,0 @@
-package org.openstreetmap.gui.jmapviewer;
-
-import java.io.EOFException;
-import java.io.FilterInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-
-/**
- * An {@link FilterInputStream} implementation that offers a {@link #stop()}
- * method. The difference between {@link #stop()} and {@link #close()} is that
- * {@link #stop()} guarantees
- * 
- * @author Jan Peter Stotz
- */
-public class StoppableInputStream extends FilterInputStream {
-
-	boolean stopped;
-
-	public StoppableInputStream(InputStream in) {
-		super(in);
-		stopped = false;
-	}
-
-	public void stop() {
-		stopped = true;
-	}
-
-	@Override
-	public int read() throws IOException {
-		if (stopped)
-			return -1;
-		return super.read();
-	}
-
-	@Override
-	public int read(byte[] b, int off, int len) throws IOException {
-		if (stopped)
-			throw new EOFException();
-		return super.read(b, off, len);
-	}
-
-	@Override
-	public int read(byte[] b) throws IOException {
-		if (stopped)
-			throw new EOFException();
-		return super.read(b);
-	}
-
-	public boolean isStopped() {
-		return stopped;
-	}
-
-}
Index: applications/viewer/jmapviewer/src/org/openstreetmap/gui/jmapviewer/Tile.java
===================================================================
--- applications/viewer/jmapviewer/src/org/openstreetmap/gui/jmapviewer/Tile.java	(revision 9780)
+++ applications/viewer/jmapviewer/src/org/openstreetmap/gui/jmapviewer/Tile.java	(revision 9784)
@@ -31,6 +31,5 @@
 	protected boolean loaded = false;
 	protected boolean loading = false;
-	public static final int WIDTH = 256;
-	public static final int HEIGHT = 256;
+	public static final int SIZE = 256;
 
 	/**
@@ -63,5 +62,5 @@
 	 */
 	public void loadPlaceholderFromCache(TileCache cache) {
-		BufferedImage tmpImage = new BufferedImage(WIDTH, HEIGHT, BufferedImage.TYPE_INT_RGB);
+		BufferedImage tmpImage = new BufferedImage(SIZE, SIZE, BufferedImage.TYPE_INT_RGB);
 		Graphics2D g = (Graphics2D) tmpImage.getGraphics();
 		// g.drawImage(image, 0, 0, null);
@@ -83,5 +82,5 @@
 						if (tile != null && tile.isLoaded()) {
 							paintedTileCount++;
-							tile.paint(g, x * WIDTH, y * HEIGHT);
+							tile.paint(g, x * SIZE, y * SIZE);
 						}
 					}
@@ -100,6 +99,6 @@
 				double scale = (double) factor;
 				AffineTransform at = new AffineTransform();
-				int translate_x = (xtile % factor) * WIDTH;
-				int translate_y = (ytile % factor) * HEIGHT;
+				int translate_x = (xtile % factor) * SIZE;
+				int translate_y = (ytile % factor) * SIZE;
 				at.setTransform(scale, 0, 0, scale, -translate_x, -translate_y);
 				g.setTransform(at);
