Class NewtCanvasAWT
- All Implemented Interfaces:
AWTPrintLifecycle,OffscreenLayerOption,WindowClosingProtocol,ImageObserver,MenuContainer,Serializable,Accessible
Canvas containing a NEWT Window using native parenting.
Offscreen Layer Remarks
setShallUseOffscreenLayer(true)
maybe called to use an offscreen drawable (FBO or PBuffer) allowing
the underlying JAWT mechanism to composite the image, if supported.- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class java.awt.Component
Component.BaselineResizeBehaviorNested classes/interfaces inherited from interface com.jogamp.nativewindow.awt.AWTPrintLifecycle
AWTPrintLifecycle.ContextNested classes/interfaces inherited from interface com.jogamp.nativewindow.WindowClosingProtocol
WindowClosingProtocol.WindowClosingMode -
Field Summary
FieldsFields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENTFields inherited from interface com.jogamp.nativewindow.awt.AWTPrintLifecycle
DEFAULT_PRINT_TILE_SIZEFields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH -
Constructor Summary
ConstructorsConstructorDescriptionInstantiates a NewtCanvas without a NEWT child.NewtCanvasAWT(Window child) Instantiates a NewtCanvas with a NEWT child.Instantiates a NewtCanvas without a NEWT child.NewtCanvasAWT(GraphicsConfiguration gc, Window child) Instantiates a NewtCanvas with a NEWT child. -
Method Summary
Modifier and TypeMethodDescriptionvoidfinal voiddestroy()Destroys this resource: Make the NEWT Child invisible Disconnects the NEWT Child from this Canvas NativeWindow, reparent to NULL Issuesdestroy()on the NEWT Child Remove reference to the NEWT Childfinal booleanReturns the property set byOffscreenLayerOption.setShallUseOffscreenLayer(boolean).final booleanfinal booleanisApplet()Returns true if the AWT component is parented to anApplet, otherwise false.final booleanReturnstrueif Key and Mouse input events will be passed through AWT, otherwise only theNEWT childwill receive them.final booleanReturns true if this instance uses an offscreen layer, otherwise false.voidvoidvoidShall be called afterPrinterJob.print().voidvoidreshape(int x, int y, int width, int height) setNEWTChild(Window newChild) Sets a new NEWT child, provoking reparenting.voidsetShallUseOffscreenLayer(boolean v) Request an offscreen layer, if supported.final voidsetSkipJAWTDestroy(boolean v) Mitigates Bug 910 (IcedTea-Web), i.e.voidsetupPrint(double scaleMatX, double scaleMatY, int numSamples, int tileWidth, int tileHeight) Shall be called beforePrinterJob.print().voidMethods inherited from class java.awt.Canvas
createBufferStrategy, createBufferStrategy, getAccessibleContext, getBufferStrategyMethods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, bounds, checkImage, checkImage, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, deliverEvent, disable, dispatchEvent, doLayout, enable, enable, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getAlignmentX, getAlignmentY, getBackground, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentAt, getComponentAt, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeys, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getListeners, getLocale, getLocation, getLocation, getLocationOnScreen, getMaximumSize, getMinimumSize, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, invalidate, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusCycleRoot, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, layout, list, list, list, list, list, locate, location, lostFocus, minimumSize, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, preferredSize, prepareImage, prepareImage, printAll, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeys, setFocusTraversalKeysEnabled, setFont, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setMixingCutoutShape, setName, setPreferredSize, setSize, setSize, setVisible, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle, validate
-
Field Details
-
DEBUG
public static final boolean DEBUG
-
-
Constructor Details
-
NewtCanvasAWT
public NewtCanvasAWT()Instantiates a NewtCanvas without a NEWT child. -
NewtCanvasAWT
Instantiates a NewtCanvas without a NEWT child. -
NewtCanvasAWT
Instantiates a NewtCanvas with a NEWT child. -
NewtCanvasAWT
Instantiates a NewtCanvas with a NEWT child.
-
-
Method Details
-
setShallUseOffscreenLayer
public void setShallUseOffscreenLayer(boolean v) Description copied from interface:OffscreenLayerOptionRequest an offscreen layer, if supported.Shall be called before the first
NativeSurface.lockSurface(), and hence before realization.- Specified by:
setShallUseOffscreenLayerin interfaceOffscreenLayerOption- See Also:
-
getShallUseOffscreenLayer
public final boolean getShallUseOffscreenLayer()Description copied from interface:OffscreenLayerOptionReturns the property set byOffscreenLayerOption.setShallUseOffscreenLayer(boolean).- Specified by:
getShallUseOffscreenLayerin interfaceOffscreenLayerOption
-
isOffscreenLayerSurfaceEnabled
public final boolean isOffscreenLayerSurfaceEnabled()Description copied from interface:OffscreenLayerOptionReturns true if this instance uses an offscreen layer, otherwise false.This instance is an offscreen layer, if
The return value is undefined before issuing the firstsetShallUseOffscreenLayer(true)has been called before it's realization and first lock and the underlying implementation supports it.NativeSurface.lockSurface().- Specified by:
isOffscreenLayerSurfaceEnabledin interfaceOffscreenLayerOption- See Also:
-
isApplet
public final boolean isApplet()Returns true if the AWT component is parented to anApplet, otherwise false. This information is valid only afteraddNotify()is issued. -
setNEWTChild
Sets a new NEWT child, provoking reparenting.A previously detached
newChildwill be released to top-level status and made invisible.Note: When switching NEWT child's, detaching the previous first via
setNEWTChild(null)produced much cleaner visual results.- Returns:
- the previous attached newt child.
-
getNEWTChild
- Returns:
- the current NEWT child
-
getNativeWindow
- Returns:
- this AWT Canvas NativeWindow representation, may be null in case
removeNotify()has been called, oraddNotify()hasn't been called yet.
-
getDefaultCloseOperation
- Specified by:
getDefaultCloseOperationin interfaceWindowClosingProtocol- Returns:
- the current close operation value
- See Also:
-
setDefaultCloseOperation
public WindowClosingProtocol.WindowClosingMode setDefaultCloseOperation(WindowClosingProtocol.WindowClosingMode op) - Specified by:
setDefaultCloseOperationin interfaceWindowClosingProtocol- Parameters:
op- the new close operation value- Returns:
- the previous close operation value
- See Also:
-
setSkipJAWTDestroy
public final void setSkipJAWTDestroy(boolean v) Mitigates Bug 910 (IcedTea-Web), i.e. crash via removeNotify() invoked before Applet.destroy().skipJAWTDestroydefaults tofalse. Due to above IcedTea-Web issue theAppletcode needs to avoid JAWT destruction beforeApplet.destroy()is reached by settingskipJAWTDestroytotrue. Afterwards the value should be reset tofalseanddestroy()needs to be called, which finally will perform the pending JAWT destruction. -
getSkipJAWTDestroy
public final boolean getSkipJAWTDestroy() -
getGraphicsConfiguration
Overridden to choose a
GraphicsConfigurationfrom a parent container'sGraphicsDevice.Method also intercepts
GraphicsConfigurationchanges regarding to its capabilities and itsGraphicsDevice. This may happen in case the display changes its configuration or the component is moved to another screen.- Overrides:
getGraphicsConfigurationin classComponent
-
addNotify
public void addNotify() -
removeNotify
public void removeNotify()- Overrides:
removeNotifyin classComponent
-
destroy
public final void destroy()Destroys this resource:- Make the NEWT Child invisible
- Disconnects the NEWT Child from this Canvas NativeWindow, reparent to NULL
- Issues
destroy()on the NEWT Child - Remove reference to the NEWT Child
- See Also:
-
paint
-
update
-
reshape
public void reshape(int x, int y, int width, int height) -
setupPrint
public void setupPrint(double scaleMatX, double scaleMatY, int numSamples, int tileWidth, int tileHeight) Description copied from interface:AWTPrintLifecycleShall be called beforePrinterJob.print().See Usage.
- Specified by:
setupPrintin interfaceAWTPrintLifecycle- Parameters:
scaleMatX-Graphics2Dscaling factor, i.e. rendering 1/scaleMatX * width pixelsscaleMatY-Graphics2Dscaling factor, i.e. rendering 1/scaleMatY * height pixelsnumSamples- multisampling value: < 0 turns off, == 0 leaves as-is, > 0 enables using given num samplestileWidth- custom tile width fortile renderer, pass -1 for default.tileHeight- custom tile height fortile renderer, pass -1 for default. FIXME: Add border size !
-
releasePrint
public void releasePrint()Description copied from interface:AWTPrintLifecycleShall be called afterPrinterJob.print().See Usage.
- Specified by:
releasePrintin interfaceAWTPrintLifecycle
-
print
-
isAWTEventPassThrough
public final boolean isAWTEventPassThrough()Returnstrueif Key and Mouse input events will be passed through AWT, otherwise only theNEWT childwill receive them.Normally only the
NEWT childwill receive Key and Mouse input events. In offscreen mode, e.g. OSX/CALayer, the AWT events will be received and translated into NEWT events and delivered to the NEWT child window.
Note: AWT key events willconsumedin pass-through mode.
-