/** * Destroys this resource: * <ul> * <li> Make the NEWT Child invisible </li> * <li> Disconnects the NEWT Child from this Canvas NativeWindow, reparent to NULL </li> * <li> Issues <code>destroy()</code> on the NEWT Child</li> * <li> Remove reference to the NEWT Child</li> * </ul> * @see Window#destroy() */ @Override public void dispose() { if( null != newtChild ) { if(DEBUG) { System.err.println("NewtCanvasSWT.dispose.0: EDTUtil cur "+newtChild.getScreen().getDisplay().getEDTUtil()+ ",\n\t"+newtChild); } configureNewtChild(false); newtChild.setVisible(false); newtChild.reparentWindow(null, -1, -1, 0 /* hint */); newtChild.destroy(); newtChild = null; } screen.getDevice().close(); nativeWindow = null; super.dispose(); }
private final void detachNewtChild(final java.awt.Container cont) { if( null == newtChild || null == jawtWindow || !newtChildAttached ) { return; // nop } if(DEBUG) { // if ( isShowing() == false ) -> Container was not visible yet. // if ( isShowing() == true ) -> Container is already visible. System.err.println("NewtCanvasAWT.detachNewtChild.0: win "+newtWinHandleToHexString(newtChild)+ ", EDTUtil: cur "+newtChild.getScreen().getDisplay().getEDTUtil()+ ", comp "+this+", visible "+isVisible()+", showing "+isShowing()+", displayable "+isDisplayable()+ ", cont "+cont); } newtChild.removeSurfaceUpdatedListener(jawtWindow); newtChildAttached = false; newtChild.setFocusAction(null); // no AWT focus traversal .. configureNewtChild(false); newtChild.setVisible(false); newtChild.reparentWindow(null, -1, -1, 0 /* hint */); // will destroy context (offscreen -> onscreen) and implicit detachSurfaceLayer if(DEBUG) { System.err.println("NewtCanvasAWT.detachNewtChild.X: win "+newtWinHandleToHexString(newtChild)+", EDTUtil: cur "+newtChild.getScreen().getDisplay().getEDTUtil()+", comp "+this); } }
newtChild.reparentWindow(nativeWindow, -1, -1, Window.REPARENT_HINT_BECOMES_VISIBLE); newtChild.setVisible(true); configureNewtChild(true); configureNewtChild(false); newtChild.setVisible(false); newtChild.reparentWindow(null, -1, -1, 0 /* hints */);
newtChild.reparentWindow(jawtWindow, -1, -1, Window.REPARENT_HINT_BECOMES_VISIBLE); newtChild.addSurfaceUpdatedListener(jawtWindow); if( jawtWindow.isOffscreenLayerSurfaceEnabled() &&