Index: trunk/src/org/openstreetmap/josm/gui/download/BoundingBoxSelection.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/download/BoundingBoxSelection.java	(revision 2482)
+++ trunk/src/org/openstreetmap/josm/gui/download/BoundingBoxSelection.java	(revision 2483)
@@ -56,4 +56,12 @@
 
 
+    protected void registerBoundingBoxBuilder() {
+        BoundingBoxBuilder bboxbuilder = new BoundingBoxBuilder();
+        for (int i = 0;i < latlon.length; i++) {
+            latlon[i].addFocusListener(bboxbuilder);
+            latlon[i].addActionListener(bboxbuilder);
+        }
+    }
+
     protected void buildDownloadAreaInputFields() {
         latlon = new JTextField[4];
@@ -78,4 +86,6 @@
         latlon[3].addFocusListener(lonChecker);
         latlon[3].addActionListener(lonChecker);
+
+        registerBoundingBoxBuilder();
     }
 
@@ -175,6 +185,6 @@
         latlon[2].setText(Double.toString(area.getMax().lat()));
         latlon[3].setText(Double.toString(area.getMax().lon()));
-        for (JTextField f : latlon) {
-            f.setCaretPosition(0);
+        for (JTextField tf: latlon) {
+            resetErrorMessage(tf);
         }
     }
@@ -185,19 +195,20 @@
     }
 
+    private Border errorBorder = BorderFactory.createLineBorder(Color.RED, 1);
+
+    protected void setErrorMessage(JTextField tf, String msg) {
+        tf.setBorder(errorBorder);
+        tf.setToolTipText(msg);
+    }
+
+    protected void resetErrorMessage(JTextField tf) {
+        tf.setBorder(UIManager.getBorder("TextField.border"));
+        tf.setToolTipText("");
+    }
+
 
     class LatValueChecker extends FocusAdapter implements ActionListener{
         private JTextField tfLatValue;
 
-        private Border errorBorder = BorderFactory.createLineBorder(Color.RED, 1);
-        protected void setErrorMessage(String msg) {
-            if (msg != null) {
-                tfLatValue.setBorder(errorBorder);
-                tfLatValue.setToolTipText(msg);
-            } else {
-                tfLatValue.setBorder(UIManager.getBorder("TextField.border"));
-                tfLatValue.setToolTipText("");
-            }
-        }
-
         public LatValueChecker(JTextField tfLatValue) {
             this.tfLatValue = tfLatValue;
@@ -209,12 +220,12 @@
                 value = Double.parseDouble(tfLatValue.getText());
             } catch(NumberFormatException ex) {
-                setErrorMessage(tr("The string ''{0}'' isn''t a valid double value.", tfLatValue.getText()));
+                setErrorMessage(tfLatValue,tr("The string ''{0}'' isn''t a valid double value.", tfLatValue.getText()));
                 return;
             }
             if (!LatLon.isValidLat(value)) {
-                setErrorMessage(tr("Value for latitude in range [-90,90] required.", tfLatValue.getText()));
+                setErrorMessage(tfLatValue,tr("Value for latitude in range [-90,90] required.", tfLatValue.getText()));
                 return;
             }
-            setErrorMessage(null);
+            resetErrorMessage(tfLatValue);
         }
 
@@ -231,14 +242,4 @@
     class LonValueChecker extends FocusAdapter implements ActionListener {
         private JTextField tfLonValue;
-        private Border errorBorder = BorderFactory.createLineBorder(Color.RED, 1);
-        protected void setErrorMessage(String msg) {
-            if (msg != null) {
-                tfLonValue.setBorder(errorBorder);
-                tfLonValue.setToolTipText(msg);
-            } else {
-                tfLonValue.setBorder(UIManager.getBorder("TextField.border"));
-                tfLonValue.setToolTipText("");
-            }
-        }
 
         public LonValueChecker(JTextField tfLonValue) {
@@ -251,12 +252,12 @@
                 value = Double.parseDouble(tfLonValue.getText());
             } catch(NumberFormatException ex) {
-                setErrorMessage(tr("The string ''{0}'' isn''t a valid double value.", tfLonValue.getText()));
+                setErrorMessage(tfLonValue,tr("The string ''{0}'' isn''t a valid double value.", tfLonValue.getText()));
                 return;
             }
             if (!LatLon.isValidLon(value)) {
-                setErrorMessage(tr("Value for longitude in range [-180,180] required.", tfLonValue.getText()));
+                setErrorMessage(tfLonValue,tr("Value for longitude in range [-180,180] required.", tfLonValue.getText()));
                 return;
             }
-            setErrorMessage(null);
+            resetErrorMessage(tfLonValue);
         }
 
@@ -336,3 +337,39 @@
         }
     }
+
+    class BoundingBoxBuilder extends FocusAdapter implements ActionListener {
+        protected Bounds build() {
+            double minlon, minlat, maxlon,maxlat;
+            try {
+                minlon = Double.parseDouble(latlon[0].getText().trim());
+                minlat = Double.parseDouble(latlon[1].getText().trim());
+                maxlon = Double.parseDouble(latlon[2].getText().trim());
+                maxlat = Double.parseDouble(latlon[3].getText().trim());
+            } catch(NumberFormatException e) {
+                return null;
+            }
+            if (!LatLon.isValidLon(minlon) || !LatLon.isValidLon(maxlon)
+                    || !LatLon.isValidLat(minlat) || ! LatLon.isValidLat(maxlat))
+                return null;
+            if (minlon > maxlon)
+                return null;
+            if (minlat > maxlat)
+                return null;
+            return new Bounds(minlon,minlat,maxlon,maxlat);
+        }
+
+        protected void refreshBounds() {
+            Bounds  b = build();
+            parent.boundingBoxChanged(b, BoundingBoxSelection.this);
+        }
+
+        @Override
+        public void focusLost(FocusEvent e) {
+            refreshBounds();
+        }
+
+        public void actionPerformed(ActionEvent e) {
+            refreshBounds();
+        }
+    }
 }
