Dimension d = paletteSplit.getSize();   paletteSplit.setDividerLocation(1.0 - ((currentMap.getTileHeightMax() + 45) / d.getHeight()));
    public void setCurrentMap(Map newMap) {        // Cancel any active selection        if (marqueeSelection != null) {            currentMap.removeLayerSpecial(marqueeSelection);        }        marqueeSelection = null;        currentMap = newMap;        boolean mapLoaded = currentMap != null;        // Create a default brush (protect against a bug with custom brushes)        ShapeBrush sb = new ShapeBrush();        sb.makeQuadBrush(new Rectangle(0, 0, 1, 1));        setBrush(sb);        if (tilePaletteDialog != null) {            tilePaletteDialog.setMap(currentMap);        }        tabbedTilesetsPane.setMap(currentMap);        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(" ");            setCurrentTile(null);        } else {            final Preferences display = prefs.node("display");            mapEventAdapter.fireEvent(MapEventAdapter.ME_MAPACTIVE);            mapView = MapView.createViewforMap(currentMap, this);            mapView.addMouseListener(this);            mapView.addMouseMotionListener(this);            mapView.addComponentListener(this);            mapView.setGridOpacity(display.getInt("gridOpacity", 255));            mapView.setAntialiasGrid(display.getBoolean("gridAntialias", true));            mapView.setGridColor(new Color(display.getInt("gridColor",                    MapView.DEFAULT_GRID_COLOR.getRGB())));            mapView.setShowGrid(display.getBoolean("showGrid", false));            JViewport mapViewport = new JViewport();            mapViewport.setView(mapView);            mapViewport.addChangeListener(this);            mapScrollPane.setViewport(mapViewport);            setCurrentPointerState(PS_PAINT);            currentMap.addMapChangeListener(this);            gridMenuItem.setState(mapView.getShowGrid());            coordinatesMenuItem.setState(                    mapView.getMode(MapView.PF_COORDINATES));            tileCoordsLabel.setText(String.valueOf(currentMap.getWidth() - 1)                    + ", " + (currentMap.getHeight() - 1));            tileCoordsLabel.setPreferredSize(null);            Dimension size = tileCoordsLabel.getPreferredSize();            tileCoordsLabel.setText(" ");            tileCoordsLabel.setMinimumSize(size);            tileCoordsLabel.setPreferredSize(size);            zoomLabel.setText(                    String.valueOf((int) (mapView.getZoom() * 100)) + "%");            // Get the first non-null tile from the first tileset containing            // non-null tiles.            Vector tilesets = currentMap.getTilesets();            Tile firstTile = null;            if (!tilesets.isEmpty()) {                Iterator it = tilesets.iterator();                while (it.hasNext() && firstTile == null) {                    firstTile = ((TileSet) it.next()).getFirstTile();                }            }            setCurrentTile(firstTile);            currentMap.addLayerSpecial(cursorHighlight);        }        zoomInAction.setEnabled(mapLoaded);        zoomOutAction.setEnabled(mapLoaded);        zoomNormalAction.setEnabled(mapLoaded && mapView.getZoomLevel() !=                MapView.ZOOM_NORMALSIZE);        /*        if (miniMap != null && currentMap != null) {            miniMap.setView(MapView.createViewforMap(currentMap));        }        */        undoHandler.discardAllEdits();        updateLayerTable();        updateTitle();    }