- Timestamp:
- 2008-06-26T19:36:52+02:00 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/download/BoundingBoxSelection.java
r627 r659 11 11 import java.awt.event.FocusEvent; 12 12 import java.awt.event.FocusListener; 13 import java.awt.event.KeyAdapter;14 import java.awt.event.KeyEvent;15 import java.awt.event.KeyListener;16 13 import java.util.HashMap; 17 14 … … 21 18 import javax.swing.JTextField; 22 19 import javax.swing.SwingUtilities; 20 import javax.swing.event.DocumentListener; 21 import javax.swing.event.DocumentEvent; 23 22 24 23 import org.openstreetmap.josm.Main; … … 78 77 f.addFocusListener(dialogUpdater); 79 78 } 80 81 final KeyListener osmUrlRefresher = new KeyAdapter() { 82 @Override public void keyTyped(KeyEvent e) { 83 SwingUtilities.invokeLater(new Runnable() { 84 public void run() { 85 Bounds b = osmurl2bounds(osmUrl.getText()); 86 if (b != null) { 87 gui.minlon = b.min.lon(); 88 gui.minlat = b.min.lat(); 89 gui.maxlon = b.max.lon(); 90 gui.maxlat = b.max.lat(); 91 gui.boundingBoxChanged(BoundingBoxSelection.this); 92 updateBboxFields(gui); 93 updateSizeCheck(gui); 94 } 95 } 96 }); 79 class osmUrlRefresher implements DocumentListener { 80 public void changedUpdate(DocumentEvent e) { dowork(); } 81 public void insertUpdate(DocumentEvent e) { dowork(); } 82 public void removeUpdate(DocumentEvent e) { dowork(); } 83 private void dowork() { 84 Bounds b = osmurl2bounds(osmUrl.getText()); 85 if (b != null) { 86 gui.minlon = b.min.lon(); 87 gui.minlat = b.min.lat(); 88 gui.maxlon = b.max.lon(); 89 gui.maxlat = b.max.lat(); 90 gui.boundingBoxChanged(BoundingBoxSelection.this); 91 updateBboxFields(gui); 92 updateSizeCheck(gui); 93 } 97 94 } 98 95 }; 99 96 100 osmUrl. addKeyListener(osmUrlRefresher);97 osmUrl.getDocument().addDocumentListener(new osmUrlRefresher()); 101 98 102 99 // select content on receiving focus. this seems to be the default in the
Note:
See TracChangeset
for help on using the changeset viewer.