Changeset 1336 in josm for trunk/src/org/openstreetmap
- Timestamp:
- 2009-01-25T13:57:40+01:00 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/download/BoundingBoxSelection.java
r1307 r1336 10 10 import java.awt.event.FocusEvent; 11 11 import java.awt.event.FocusListener; 12 import java.awt.event.KeyEvent; 13 import java.awt.event.KeyListener; 12 14 import java.awt.event.MouseAdapter; 13 15 import java.util.HashMap; … … 18 20 import javax.swing.JTextField; 19 21 import javax.swing.SwingUtilities; 20 import javax.swing.event.DocumentListener;21 import javax.swing.event.DocumentEvent;22 22 23 23 import org.openstreetmap.josm.data.Bounds; … … 75 75 f.addFocusListener(dialogUpdater); 76 76 } 77 class osmUrlRefresher implements DocumentListener { 78 public void changedUpdate(DocumentEvent e) { dowork(); } 79 public void insertUpdate(DocumentEvent e) { dowork(); } 80 public void removeUpdate(DocumentEvent e) { dowork(); } 81 private void dowork() { 82 Bounds b = OsmUrlToBounds.parse(osmUrl.getText()); 83 if (b != null) { 84 gui.minlon = b.min.lon(); 85 gui.minlat = b.min.lat(); 86 gui.maxlon = b.max.lon(); 87 gui.maxlat = b.max.lat(); 88 gui.boundingBoxChanged(BoundingBoxSelection.this); 89 updateBboxFields(gui); 90 updateUrl(gui); 91 } 92 } 93 } 77 78 KeyListener osmUrlKeyListener = new KeyListener() { 79 public void keyPressed(KeyEvent keyEvent) {} 94 80 95 osmUrl.getDocument().addDocumentListener(new osmUrlRefresher()); 81 public void keyReleased(KeyEvent keyEvent) { 82 Bounds b = OsmUrlToBounds.parse(osmUrl.getText()); 83 if (b != null) { 84 gui.minlon = b.min.lon(); 85 gui.minlat = b.min.lat(); 86 gui.maxlon = b.max.lon(); 87 gui.maxlat = b.max.lat(); 88 gui.boundingBoxChanged(BoundingBoxSelection.this); 89 updateBboxFields(gui); 90 updateUrl(gui); 91 if(keyEvent.getKeyCode() == keyEvent.VK_ENTER) 92 gui.closeDownloadDialog(true); 93 } 94 } 95 96 public void keyTyped(KeyEvent keyEvent) {} 97 }; 98 99 osmUrl.addKeyListener(osmUrlKeyListener); 96 100 97 101 // select content on receiving focus. this seems to be the default in the
Note:
See TracChangeset
for help on using the changeset viewer.