Index: src/org/openstreetmap/josm/tools/WindowGeometry.java
===================================================================
--- src/org/openstreetmap/josm/tools/WindowGeometry.java	(revision 6827)
+++ src/org/openstreetmap/josm/tools/WindowGeometry.java	(working copy)
@@ -322,21 +322,37 @@
 
         Rectangle maxbounds = GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds();
 
-        deltax = size.width - maxbounds.width;
-        if (deltax > 0) {
-            size.width -= deltax;
-        }
+        if (!isBugInMaximumWindowBounds(maxbounds)) {
 
-        deltay = size.height - maxbounds.height;
-        if (deltay > 0) {
-            size.height -= deltay;
-        }
+            deltax = size.width - maxbounds.width;
+            if (deltax > 0) {
+                size.width -= deltax;
+            }
 
+            deltay = size.height - maxbounds.height;
+            if (deltay > 0) {
+                size.height -= deltay;
+            }
+        }
         window.setLocation(p);
         window.setSize(size);
     }
 
     /**
+     * Because of bug in getMaximumWindowBounds on dual screen Ubuntu. Function
+     * return incorrect values with minus sign or extremely large. This cause
+     * incorrect bounds and main windows is created with only few pixel with.
+     * More details in #9699.
+     *
+     * @param maxbounds
+     *            result of getMaximumWindowBounds
+     * @return is bug in result of getMaximumWindowBounds
+     */
+    private boolean isBugInMaximumWindowBounds(Rectangle maxbounds) {
+        return maxbounds.width <= 0 || maxbounds.height <= 0 || maxbounds.x > 1000 || maxbounds.y > 1000;
+    }
+
+    /**
      * Computes the virtual bounds of graphics environment, as an union of all screen bounds.
      * @return The virtual bounds of graphics environment, as an union of all screen bounds.
      * @since 6522
