MapView myView = currentMap.createView();
MapView myView = MapView.createViewforMap(currentMap);
    public void saveMapImage(String filename) {        if (filename == null) {            JFileChooser ch = new JFileChooser();            ch.setDialogTitle("Save as image");            if (ch.showSaveDialog(appFrame) == JFileChooser.APPROVE_OPTION) {                filename = ch.getSelectedFile().getAbsolutePath();            }        }        if (filename != null) {            MapView myView = currentMap.createView();            if (mapView.getMode(MapView.PF_GRIDMODE))                myView.enableMode(MapView.PF_GRIDMODE);            myView.enableMode(MapView.PF_NOSPECIAL);            Dimension d = myView.getPreferredSize();            BufferedImage i = new BufferedImage(d.width, d.height,                    BufferedImage.TYPE_INT_ARGB);            Graphics2D g = i.createGraphics();            g.setClip(0, 0, d.width, d.height);            myView.paint(g);            String format = filename.substring(filename.lastIndexOf('.') + 1);            try {                ImageIO.write(i, format, new File(filename));            } catch (IOException e) {                e.printStackTrace();                JOptionPane.showMessageDialog(appFrame,                        "Error while saving " + filename + ": " + e.toString(),                        "Error while saving map image",                        JOptionPane.ERROR_MESSAGE);            }        }    }