Index: /trunk/src/org/openstreetmap/josm/Main.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/Main.java	(revision 5513)
+++ /trunk/src/org/openstreetmap/josm/Main.java	(revision 5514)
@@ -790,6 +790,10 @@
         private void handleComponentEvent(ComponentEvent e) {
             Component c = e.getComponent();
-            if (c instanceof JFrame && c.isVisible() && Main.windowState == JFrame.NORMAL) {
-                Main.geometry = new WindowGeometry((JFrame) c);
+            if (c instanceof JFrame && c.isVisible()) {
+                if(Main.windowState == JFrame.NORMAL) {
+                    Main.geometry = new WindowGeometry((JFrame) c);
+                } else {
+                    Main.geometry.fixScreen((JFrame) c);
+                }
             }
         }
Index: /trunk/src/org/openstreetmap/josm/tools/WindowGeometry.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/tools/WindowGeometry.java	(revision 5513)
+++ /trunk/src/org/openstreetmap/josm/tools/WindowGeometry.java	(revision 5514)
@@ -82,5 +82,4 @@
     /**
      * Exception thrown by the WindowGeometry class if something goes wrong
-     *
      */
     static public class WindowGeometryException extends Exception {
@@ -100,4 +99,5 @@
 
     /**
+     * Creates a window geometry from a position and dimension
      *
      * @param topLeft the top left point
@@ -110,5 +110,6 @@
 
     /**
-     *
+     * Creates a window geometry from a rectangle
+     * 
      * @param rect the position
      */
@@ -125,4 +126,20 @@
     public WindowGeometry(Window window)  {
         this(window.getLocationOnScreen(), window.getSize());
+    }
+
+    /**
+     * Fixes a window geometry to shift to the correct screen.
+     *
+     * @param window the window
+     */
+    public void fixScreen(Window window)  {
+        Rectangle oldScreen = getScreenInfo(getRectangle());
+        Rectangle newScreen = getScreenInfo(new Rectangle(window.getLocationOnScreen(), window.getSize()));
+        if(oldScreen.x != newScreen.x) {
+            this.topLeft.x += newScreen.x - oldScreen.x;
+        }
+        if(oldScreen.y != newScreen.y) {
+            this.topLeft.y += newScreen.y - oldScreen.y;
+        }
     }
 
@@ -250,7 +267,7 @@
 
     /**
-     * Replies the size spezified by the geometry
-     *
-     * @return the size spezified by the geometry
+     * Replies the size specified by the geometry
+     *
+     * @return the size specified by the geometry
      */
     public Dimension getSize() {
@@ -258,4 +275,9 @@
     }
 
+    /**
+     * Replies the size and position specified by the geometry
+     *
+     * @return the size and position specified by the geometry
+     */
     private Rectangle getRectangle() {
         return new Rectangle(topLeft, extent);
@@ -278,5 +300,5 @@
             GraphicsDevice gd = gs[j];
             if (gd.getType() == GraphicsDevice.TYPE_RASTER_SCREEN) {
-            	virtualBounds = virtualBounds.union(gd.getDefaultConfiguration().getBounds());
+                virtualBounds = virtualBounds.union(gd.getDefaultConfiguration().getBounds());
             }
         }
@@ -303,4 +325,5 @@
      * 
      * @param preferenceKey the key to get size and position from
+     * @return bounds of the screen
      */
     public static Rectangle getScreenInfo(String preferenceKey) {
@@ -308,4 +331,15 @@
             /* default: something on screen 1 */
             new WindowGeometry(new Point(0,0), new Dimension(10,10))).getRectangle();
+        return getScreenInfo(g);
+    }
+
+    /**
+     * Find the size and position of the screen for given coordinates. Use first screen,
+     * when no coordinates are stored or null is passed.
+     * 
+     * @param g coordinates to check
+     * @return bounds of the screen
+     */
+    private static Rectangle getScreenInfo(Rectangle g) {
         GraphicsEnvironment ge = GraphicsEnvironment
                 .getLocalGraphicsEnvironment();
@@ -351,4 +385,5 @@
     /**
      * Find the size of the full virtual screen.
+     * @return size of the full virtual screen
      */
     public static Rectangle getFullScreenInfo() {
