- try {
- return new ImageIcon(ImageIO.read(pngfile));
- } catch (IOException e) {
- System.out.printf("# IO error trying to load %s\n", pngfile);
- return null;
- }
- }
-}
+ public static ImageIcon fetchAndLoadMap(File pngfile, String url) {
+ if (!pngfile.exists()) {
+ if (!fetchMap(pngfile, url)) {
+ return null;
+ }
+ }
+ return loadMap(pngfile, url);
+ }
+
+ public static ImageIcon loadMap(File pngfile, String url) {
+ if (!pngfile.exists()) {
+ return null;
+ }