public void cleanup() { if (layer != null) { this.layer.removeComponentListener(this);
public void cleanup(ButtonGroup bg) { if (bg != null) { bg.remove(layerName);
    public void cleanup() {        if (layer != null) {            this.layer.removeComponentListener(this);        }        if (onoffButton != null) {            onoffButton.removeActionListener(this);        }        if (paletteButton != null) {            paletteButton.removeActionListener(this);        }        layerName = null;        this.layer = null;        this.layerHandler = null;        this.removeAll();    }