Layer layer = getAppropriateLayer(); if (changed) { currentLayer.removeNotify(); setPaletteTab(targetIndex); remove(currentLayer);    add(layer); layer.addNotify(); checkMouseMode(); }
Layer layer = configureAppropriateLayer(proj.getScale());
    public void projectionChanged(ProjectionEvent ev) {        Projection proj = ev.getProjection();        Layer currentLayer = getAppropriateLayer();        boolean changed = setTargetIndex(proj.getScale());        // get the appropriate layer and invoke projectionChanged        Layer layer = getAppropriateLayer();        if (changed) {            currentLayer.removeNotify();            setPaletteTab(targetIndex);            remove(currentLayer);            // This will handle the repaint() requests from the            // layer...            add(layer);            layer.addNotify();            checkMouseMode();        }        fireStatusUpdate(LayerStatusEvent.START_WORKING);        layer.projectionChanged(ev);    }