canvasIdAlloc = true;
    public void addNotify() {        // Issue 131: This method is now being called by JCanvas3D for its        // off-screen Canvas3D, so we need to handle off-screen properly here.        // Do nothing for manually-rendered off-screen canvases        if (manualRendering) {            return;        }	Renderer rdr = null;	if (isRunning && (screen != null)) {	    // If there is other Canvas3D in the same screen	    // rendering, stop it before JDK create new Canvas	    rdr = screen.renderer;	    if (rdr != null) {		VirtualUniverse.mc.postRequest(MasterControl.STOP_RENDERER, rdr);		while (!rdr.userStop) {		    MasterControl.threadYield();		}	    }	}        // Issue 131: Don't call super for off-screen Canvas3D        if (!offScreen) {            super.addNotify();        }	screen.addUser(this);	parent = this.getParent();	while (!(parent instanceof Window)) {	    parent = parent.getParent();        }	        ((Window)parent).addWindowListener(eventCatcher);	if (VirtualUniverse.mc.isD3D()) {	    ((Window)parent).addComponentListener(eventCatcher);	}        if(canvasViewEventCatcher.parentList.size() > 0) {            Component comp;            //Release and clear.            for(int i=0; i<canvasViewEventCatcher.parentList.size(); i++) {                comp = (Component)canvasViewEventCatcher.parentList.get(i);                comp.removeComponentListener(canvasViewEventCatcher);            }            canvasViewEventCatcher.parentList.clear();        }        Component parent = (Component) this.getParent();        while(parent != null) {            parent.addComponentListener(canvasViewEventCatcher);            canvasViewEventCatcher.parentList.add(parent);            parent = parent.getParent();           }        // Need to traverse up the parent and add listener.        this.addComponentListener(canvasViewEventCatcher);	synchronized(dirtyMaskLock) {	    cvDirtyMask[0] |= MOVED_OR_RESIZED_DIRTY;	    cvDirtyMask[1] |= MOVED_OR_RESIZED_DIRTY;	}	        canvasId = VirtualUniverse.mc.getCanvasId();        canvasBit = 1 << canvasId; 	validCanvas = true;	added = true;        // Since we won't get a paint call for off-screen canvases, we need        // to set the first paint and visible flags here        if (offScreen) {            firstPaintCalled = true;            visible = true;        }	// In case the same canvas is removed and add back,	// we have to change isRunningStatus back to true;	if (isRunning && !fatalError) {	    isRunningStatus = true;	}	ctxTimeStamp = 0;	if ((view != null) && (view.universe != null)) {	    view.universe.checkForEnableEvents();	}	if (rdr != null) {            // Issue 84: Send a message to MC to restart renderer            // Note that this also obviates the need for the earlier fix to            // issue 131 which called redraw() for auto-off-screen Canvas3Ds            // (and this is a more robust fix)            VirtualUniverse.mc.postRequest(MasterControl.START_RENDERER, rdr);            while (rdr.userStop) {                MasterControl.threadYield();            }	}    }