Changeset 34760 in osm for applications/viewer/jmapviewer/src/org/openstreetmap/gui/jmapviewer/JMapViewer.java
- Timestamp:
- 2018-12-01T21:15:59+01:00 (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/viewer/jmapviewer/src/org/openstreetmap/gui/jmapviewer/JMapViewer.java
r34759 r34760 8 8 import java.awt.Point; 9 9 import java.awt.event.MouseEvent; 10 import java.io.IOException; 10 11 import java.net.URL; 11 12 import java.util.ArrayList; … … 164 165 add(zoomSlider); 165 166 int size = 18; 166 URL url = JMapViewer.class.getResource("images/plus.png"); 167 if (url != null) { 168 ImageIcon icon = new ImageIcon(url); 167 ImageIcon icon = getImageIcon("images/plus.png"); 168 if (icon != null) { 169 169 zoomInButton = new JButton(icon); 170 170 } else { … … 177 177 zoomInButton.setFocusable(false); 178 178 add(zoomInButton); 179 url = JMapViewer.class.getResource("images/minus.png"); 180 if (url != null) { 181 ImageIcon icon = new ImageIcon(url); 179 icon = getImageIcon("images/minus.png"); 180 if (icon != null) { 182 181 zoomOutButton = new JButton(icon); 183 182 } else { … … 190 189 zoomOutButton.setFocusable(false); 191 190 add(zoomOutButton); 191 } 192 193 private static ImageIcon getImageIcon(String name) { 194 URL url = JMapViewer.class.getResource(name); 195 if (url != null) { 196 try { 197 return new ImageIcon(FeatureAdapter.readImage(url)); 198 } catch (IOException e) { 199 e.printStackTrace(); 200 } 201 } 202 return null; 192 203 } 193 204
Note:
See TracChangeset
for help on using the changeset viewer.