if(currentMap != null) { currentMap.addLayerSpecial(cursorHighlight); }
    private void setCurrentMap(Map newMap) {        currentMap = newMap;        boolean mapLoaded = (currentMap != null);        if (!mapLoaded) {            mapEventAdapter.fireEvent(MapEventAdapter.ME_MAPINACTIVE);            mapView = null;            mapScrollPane.setViewportView(Box.createRigidArea(                        new Dimension(0,0)));            setCurrentPointerState(PS_POINT);            tileCoordsLabel.setPreferredSize(null);            tileCoordsLabel.setText(" ");            zoomLabel.setText(" ");            tilePalettePanel.setTilesets(null);            setCurrentTile(null);        } else {            mapEventAdapter.fireEvent(MapEventAdapter.ME_MAPACTIVE);            mapView = currentMap.createView();            mapView.addMouseListener(this);            mapView.addMouseMotionListener(this);            mapView.addComponentListener(this);            JViewport mapViewport = new JViewport();            mapViewport.setView(mapView);            mapScrollPane.setViewport(mapViewport);            setCurrentPointerState(PS_PAINT);            currentMap.addMapChangeListener(this);            gridMenuItem.setState(mapView.getMode(MapView.PF_GRIDMODE));            Vector tilesets = currentMap.getTilesets();            if (tilesets.size() > 0) {                tilePalettePanel.setTilesets(tilesets);                TileSet first = (TileSet)tilesets.get(0);                setCurrentTile(first.getFirstTile());            } else {                tilePalettePanel.setTilesets(null);                setCurrentTile(null);            }            tileCoordsLabel.setText("" + (currentMap.getWidth() - 1) + ", " +                    (currentMap.getHeight() - 1));            tileCoordsLabel.setPreferredSize(null);            Dimension size = tileCoordsLabel.getPreferredSize();            tileCoordsLabel.setText(" ");            tileCoordsLabel.setMinimumSize(size);            tileCoordsLabel.setPreferredSize(size);            zoomLabel.setText("" + (int)(mapView.getZoom() * 100) + "%");        }        zoomInAction.setEnabled(mapLoaded);        zoomOutAction.setEnabled(mapLoaded);        zoomNormalAction.setEnabled(mapLoaded && mapView.getZoomLevel() !=                MapView.ZOOM_NORMALSIZE);        if (tilePaletteDialog != null) {            tilePaletteDialog.setMap(currentMap);        }                if (miniMap != null && currentMap != null) {            miniMap.setView(currentMap.createView());        }                undoStack.discardAllEdits();        updateLayerTable();        updateTitle();        updateHistory();    }