Index: trunk/src/org/openstreetmap/josm/gui/layer/geoimage/ImageDisplay.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/layer/geoimage/ImageDisplay.java	(revision 17782)
+++ trunk/src/org/openstreetmap/josm/gui/layer/geoimage/ImageDisplay.java	(revision 17783)
@@ -25,4 +25,5 @@
 import java.io.File;
 import java.io.IOException;
+import java.util.Objects;
 
 import javax.imageio.ImageIO;
@@ -54,4 +55,7 @@
     private ImageEntry entry;
 
+    /** The previous file that is currently displayed. Cleared on paint. Only used to help improve UI error information. */
+    private ImageEntry oldEntry;
+
     /** The image currently displayed */
     private transient BufferedImage image;
@@ -104,4 +108,7 @@
     private static double bilinUpper;
     private static double bilinLower;
+
+    /** Show a background for the error text (may be hard on eyes) */
+    private static final BooleanProperty ERROR_MESSAGE_BACKGROUND = new BooleanProperty("geoimage.message.error.background", false);
 
     @Override
@@ -373,4 +380,6 @@
 
                         ImageDisplay.this.image = img;
+                        // This will clear the loading info box
+                        ImageDisplay.this.oldEntry = ImageDisplay.this.entry;
                         visibleRect = new VisRect(0, 0, width, height);
 
@@ -732,6 +741,10 @@
     public void setImage(ImageEntry entry) {
         synchronized (this) {
+            this.oldEntry = this.entry;
             this.entry = entry;
-            image = null;
+            if (entry == null) {
+                image = null;
+                this.oldEntry = null;
+            }
             errorLoading = false;
         }
@@ -771,4 +784,5 @@
     public void paintComponent(Graphics g) {
         ImageEntry entry;
+        ImageEntry oldEntry;
         BufferedImage image;
         VisRect visibleRect;
@@ -778,4 +792,5 @@
             image = this.image;
             entry = this.entry;
+            oldEntry = this.oldEntry;
             visibleRect = this.visibleRect;
             errorLoading = this.errorLoading;
@@ -787,27 +802,6 @@
 
         Dimension size = getSize();
-        if (entry == null) {
-            g.setColor(Color.black);
-            if (emptyText == null) {
-                emptyText = tr("No image");
-            }
-            String noImageStr = emptyText;
-            Rectangle2D noImageSize = g.getFontMetrics(g.getFont()).getStringBounds(noImageStr, g);
-            g.drawString(noImageStr,
-                    (int) ((size.width - noImageSize.getWidth()) / 2),
-                    (int) ((size.height - noImageSize.getHeight()) / 2));
-        } else if (image == null) {
-            g.setColor(Color.black);
-            String loadingStr;
-            if (!errorLoading) {
-                loadingStr = tr("Loading {0}", entry.getFile().getName());
-            } else {
-                loadingStr = tr("Error on file {0}", entry.getFile().getName());
-            }
-            Rectangle2D noImageSize = g.getFontMetrics(g.getFont()).getStringBounds(loadingStr, g);
-            g.drawString(loadingStr,
-                    (int) ((size.width - noImageSize.getWidth()) / 2),
-                    (int) ((size.height - noImageSize.getHeight()) / 2));
-        } else {
+        // Draw the image first, then draw error information
+        if (image != null && (entry != null || oldEntry != null)) {
             Rectangle r = new Rectangle(visibleRect);
             Rectangle target = calculateDrawImageRectangle(visibleRect, size);
@@ -903,4 +897,41 @@
             }
         }
+        final String errorMessage;
+        // If the new entry is null, then there is no image.
+        if (entry == null) {
+            if (emptyText == null) {
+                emptyText = tr("No image");
+            }
+            errorMessage = emptyText;
+        } else if (image == null || !Objects.equals(entry, oldEntry)) {
+            // The image is not necessarily null when loading anymore. If the oldEntry is not the same as the new entry,
+            // we are probably still loading the image. (oldEntry gets set to entry when the image finishes loading).
+            if (!errorLoading) {
+                errorMessage = tr("Loading {0}", entry.getFile().getName());
+            } else {
+                errorMessage = tr("Error on file {0}", entry.getFile().getName());
+            }
+        } else {
+            errorMessage = null;
+        }
+        if (errorMessage != null && !errorMessage.trim().isEmpty()) {
+            Rectangle2D errorStringSize = g.getFontMetrics(g.getFont()).getStringBounds(errorMessage, g);
+            if (Boolean.TRUE.equals(ERROR_MESSAGE_BACKGROUND.get())) {
+                int height = g.getFontMetrics().getHeight();
+                int descender = g.getFontMetrics().getDescent();
+                g.setColor(getBackground());
+                int width = (int) (errorStringSize.getWidth() * 1);
+                // top-left of text
+                int tlx = (int) ((size.getWidth() - errorStringSize.getWidth()) / 2);
+                int tly = (int) ((size.getHeight() - 3 * errorStringSize.getHeight()) / 2 + descender);
+                g.fillRect(tlx, tly, width, height);
+            }
+
+            // lower-left of text
+            int llx = (int) ((size.width - errorStringSize.getWidth()) / 2);
+            int lly = (int) ((size.height - errorStringSize.getHeight()) / 2);
+            g.setColor(getForeground());
+            g.drawString(errorMessage, llx, lly);
+        }
     }
 
@@ -982,4 +1013,5 @@
     public void zoomBestFitOrOne() {
         ImageEntry entry;
+        ImageEntry oldEntry;
         Image image;
         VisRect visibleRect;
