|
Jazz API Documentation | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object
|
+--java.awt.Component
|
+--java.awt.Container
|
+--javax.swing.JComponent
|
+--edu.umd.cs.jazz.util.ZCanvas
ZCanvas is a simple Swing component that can be used to render onto for Jazz. It extends JComponent, and overrides the appropriate methods so that whenever Java requests that this widget gets redrawn, the requests are forwarded on to Jazz to render appropriately. It also defines a very simple Jazz scenegraph consisting of a root, a camera, and one node. Finally, it supports capturing the current camera view onto an Image (i.e., a screengrab). It also supports the use of Swing components within Jazz by forwarding mouse, repaint, and revalidate events.
ZCanvas defines basic event handlers for panning and zooming with the keyboard and mouse which can be disabled with @link{#disableEventHandlers}.
| Inner Class Summary | |
class |
ZCanvas.ZBasicRepaintManager
This is an internal class used by Jazz to support Swing components in Jazz. |
| Inner classes inherited from class javax.swing.JComponent |
javax.swing.JComponent.AccessibleJComponent |
| Inner classes inherited from class java.awt.Container |
java.awt.Container.AccessibleAWTContainer |
| Inner classes inherited from class java.awt.Component |
java.awt.Component.AccessibleAWTComponent |
| Field Summary | |
protected ZEventHandler |
keyEventHandler
The event handler that supports key events |
protected ZEventHandler |
panEventHandler
The event handler that supports panning |
protected ZSwingEventHandler |
swingEventHandler
The event handler that supports events for Swing Visual Components |
protected ZEventHandler |
zoomEventHandler
The event handler that supports zooming |
| Fields inherited from class javax.swing.JComponent |
accessibleContext,
listenerList,
TOOL_TIP_TEXT_KEY,
ui,
UNDEFINED_CONDITION,
WHEN_ANCESTOR_OF_FOCUSED_COMPONENT,
WHEN_FOCUSED,
WHEN_IN_FOCUSED_WINDOW |
| Fields inherited from class java.awt.Component |
BOTTOM_ALIGNMENT,
CENTER_ALIGNMENT,
LEFT_ALIGNMENT,
RIGHT_ALIGNMENT,
TOP_ALIGNMENT |
| Constructor Summary | |
ZCanvas()
The default constructor for a ZCanvas. |
|
ZCanvas(ZRoot aRoot,
ZLayerGroup layer)
A constructor for a ZCanvas that uses an existing scenegraph. |
|
| Method Summary | |
ZCamera |
getCamera()
Return the camera associated with the primary surface. |
ZNode |
getCameraNode()
Return the camera's node associated with the primary surface. |
ZDrawingSurface |
getDrawingSurface()
Return the surface. |
boolean |
getEnableNodeEvents()
Determine if Jazz node event handlers should be invoked. |
ZLayerGroup |
getLayer()
Return the "layer". |
ZEventHandler |
getPanEventHandler()
Return the pan event handler. |
ZRoot |
getRoot()
Return the root of the scenegraph. |
java.awt.Image |
getScreenImage(int maxDim)
Generate a copy of the view in the current camera scaled so that the aspect ratio of the screen is maintained, and the larger dimension is scaled to match the specified parameter. |
java.awt.Image |
getScreenImage(int w,
int h)
Generate a copy of the current camera scaled to the specified dimensions. |
javax.swing.JComponent |
getSwingWrapper()
Returns the component to which Swing components are added to function properly in Jazz. |
ZEventHandler |
getZoomEventHandler()
Return the zoom event handler. |
protected void |
init()
Internal method to support initialization of a ZCanvas. |
boolean |
isFocusTraversable()
|
void |
paintComponent(java.awt.Graphics g)
This renders the Jazz scene attached to this component by passing on the Swing paint request to the underlying Jazz surface. |
void |
processMouseEvent(java.awt.event.MouseEvent e)
Internal method that overrides java.awt.Component.processMouseEvent to pass the mouse events to our listeners first, and then on to the other listeners. |
protected void |
processMouseMotionEvent(java.awt.event.MouseEvent e)
Internal method that overrides java.awt.Component.processMouseEvent to pass the mouse events to our listeners first, and then on to the other listeners. |
void |
resetCursor()
Sets the current cursor to the ZCanvas's cursor |
void |
setBackground(java.awt.Color background)
Sets the background color of this component. |
void |
setBounds(int x,
int y,
int w,
int h)
This captures changes in the component's bounds so the underlying Jazz camera can be updated to mirror bounds change. |
void |
setCamera(ZCamera aCamera)
Sets the camera. |
void |
setCursor(java.awt.Cursor c)
Sets the cursor for this ZCanvas |
void |
setCursor(java.awt.Cursor c,
boolean realSet)
Sets the cursor for this ZCanvas. |
void |
setDrawingSurface(ZDrawingSurface aSurface)
Sets the surface. |
void |
setEnableNodeEvents(boolean enable)
Specify if Jazz node event handlers should be invoked. |
void |
setLayer(ZLayerGroup aLayer)
Sets the layer. |
void |
setNavEventHandlersActive(boolean active)
Control whether event handlers are active or not for this ZCanvas. |
void |
setRoot(ZRoot aRoot)
Sets the root. |
void |
setSwingEventHandlersActive(boolean active)
|
| Methods inherited from class javax.swing.JComponent |
addAncestorListener,
addNotify,
addPropertyChangeListener,
addPropertyChangeListener,
addVetoableChangeListener,
computeVisibleRect,
contains,
createToolTip,
firePropertyChange,
firePropertyChange,
firePropertyChange,
firePropertyChange,
firePropertyChange,
firePropertyChange,
firePropertyChange,
firePropertyChange,
firePropertyChange,
fireVetoableChange,
getAccessibleContext,
getActionForKeyStroke,
getActionMap,
getAlignmentX,
getAlignmentY,
getAutoscrolls,
getBorder,
getBounds,
getClientProperty,
getComponentGraphics,
getConditionForKeyStroke,
getDebugGraphicsOptions,
getGraphics,
getHeight,
getInputMap,
getInputMap,
getInputVerifier,
getInsets,
getInsets,
getListeners,
getLocation,
getMaximumSize,
getMinimumSize,
getNextFocusableComponent,
getPreferredSize,
getRegisteredKeyStrokes,
getRootPane,
getSize,
getToolTipLocation,
getToolTipText,
getToolTipText,
getTopLevelAncestor,
getUIClassID,
getVerifyInputWhenFocusTarget,
getVisibleRect,
getWidth,
getX,
getY,
grabFocus,
hasFocus,
hide,
isDoubleBuffered,
isFocusCycleRoot,
isLightweightComponent,
isManagingFocus,
isOpaque,
isOptimizedDrawingEnabled,
isPaintingTile,
isRequestFocusEnabled,
isValidateRoot,
paint,
paintBorder,
paintChildren,
paintImmediately,
paintImmediately,
paramString,
print,
printAll,
printBorder,
printChildren,
printComponent,
processComponentKeyEvent,
processFocusEvent,
processKeyBinding,
processKeyEvent,
putClientProperty,
registerKeyboardAction,
registerKeyboardAction,
removeAncestorListener,
removeNotify,
removePropertyChangeListener,
removePropertyChangeListener,
removeVetoableChangeListener,
repaint,
repaint,
requestDefaultFocus,
requestFocus,
resetKeyboardActions,
reshape,
revalidate,
scrollRectToVisible,
setActionMap,
setAlignmentX,
setAlignmentY,
setAutoscrolls,
setBorder,
setDebugGraphicsOptions,
setDoubleBuffered,
setEnabled,
setFont,
setForeground,
setInputMap,
setInputVerifier,
setMaximumSize,
setMinimumSize,
setNextFocusableComponent,
setOpaque,
setPreferredSize,
setRequestFocusEnabled,
setToolTipText,
setUI,
setVerifyInputWhenFocusTarget,
setVisible,
unregisterKeyboardAction,
update,
updateUI |
| Methods inherited from class java.awt.Container |
add,
add,
add,
add,
add,
addContainerListener,
addImpl,
countComponents,
deliverEvent,
doLayout,
findComponentAt,
findComponentAt,
getComponent,
getComponentAt,
getComponentAt,
getComponentCount,
getComponents,
getLayout,
insets,
invalidate,
isAncestorOf,
layout,
list,
list,
locate,
minimumSize,
paintComponents,
preferredSize,
printComponents,
processContainerEvent,
processEvent,
remove,
remove,
removeAll,
removeContainerListener,
setLayout,
validate,
validateTree |
| Methods inherited from class java.awt.Component |
action,
add,
addComponentListener,
addFocusListener,
addHierarchyBoundsListener,
addHierarchyListener,
addInputMethodListener,
addKeyListener,
addMouseListener,
addMouseMotionListener,
bounds,
checkImage,
checkImage,
coalesceEvents,
contains,
createImage,
createImage,
disable,
disableEvents,
dispatchEvent,
enable,
enable,
enableEvents,
enableInputMethods,
getBackground,
getBounds,
getColorModel,
getComponentOrientation,
getCursor,
getDropTarget,
getFont,
getFontMetrics,
getForeground,
getGraphicsConfiguration,
getInputContext,
getInputMethodRequests,
getLocale,
getLocation,
getLocationOnScreen,
getName,
getParent,
getPeer,
getSize,
getToolkit,
getTreeLock,
gotFocus,
handleEvent,
imageUpdate,
inside,
isDisplayable,
isEnabled,
isLightweight,
isShowing,
isValid,
isVisible,
keyDown,
keyUp,
list,
list,
list,
location,
lostFocus,
mouseDown,
mouseDrag,
mouseEnter,
mouseExit,
mouseMove,
mouseUp,
move,
nextFocus,
paintAll,
postEvent,
prepareImage,
prepareImage,
processComponentEvent,
processHierarchyBoundsEvent,
processHierarchyEvent,
processInputMethodEvent,
remove,
removeComponentListener,
removeFocusListener,
removeHierarchyBoundsListener,
removeHierarchyListener,
removeInputMethodListener,
removeKeyListener,
removeMouseListener,
removeMouseMotionListener,
repaint,
repaint,
repaint,
resize,
resize,
setBounds,
setComponentOrientation,
setDropTarget,
setLocale,
setLocation,
setLocation,
setName,
setSize,
setSize,
show,
show,
size,
toString,
transferFocus |
| Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
wait,
wait,
wait |
| Field Detail |
protected ZSwingEventHandler swingEventHandler
protected ZEventHandler panEventHandler
protected ZEventHandler zoomEventHandler
protected ZEventHandler keyEventHandler
| Constructor Detail |
public ZCanvas()
getRoot(),
getDrawingSurface(),
getCamera(),
getLayer()
public ZCanvas(ZRoot aRoot,
ZLayerGroup layer)
aRoot - The existing root of the scenegraph this component is attached tolayer - The existing layer node of the scenegraph that this component's camera looks ontogetRoot(),
getDrawingSurface(),
getCamera(),
getLayer()| Method Detail |
protected void init()
public void paintComponent(java.awt.Graphics g)
g - The graphics to be painted onto
public void setBounds(int x,
int y,
int w,
int h)
x - The X-coord of the top-left corner of the componenty - The Y-coord of the top-left corner of the componentwidth - The width of the componentheight - The Height of the componentpublic void setBackground(java.awt.Color background)
background - The new color to use for this component's backgroundpublic void setDrawingSurface(ZDrawingSurface aSurface)
surface - the surfacepublic ZDrawingSurface getDrawingSurface()
public void setCamera(ZCamera aCamera)
camera - the camerapublic ZCamera getCamera()
public ZNode getCameraNode()
public void setRoot(ZRoot aRoot)
root - the rootpublic ZRoot getRoot()
public void setLayer(ZLayerGroup aLayer)
layer - the layerpublic ZLayerGroup getLayer()
public boolean isFocusTraversable()
public java.awt.Image getScreenImage(int maxDim)
public java.awt.Image getScreenImage(int w,
int h)
w - Width of the imageh - Height of the imagepublic ZEventHandler getPanEventHandler()
public ZEventHandler getZoomEventHandler()
public void setSwingEventHandlersActive(boolean active)
public void setNavEventHandlersActive(boolean active)
public javax.swing.JComponent getSwingWrapper()
public void setEnableNodeEvents(boolean enable)
enable - True if node event handlers should be invoked.public final boolean getEnableNodeEvents()
public void processMouseEvent(java.awt.event.MouseEvent e)
e - The MouseEvent to processsetEnableNodeEvents(boolean)protected void processMouseMotionEvent(java.awt.event.MouseEvent e)
e - The MouseEvent to processsetEnableNodeEvents(boolean)public void setCursor(java.awt.Cursor c)
c - The new cursor
public void setCursor(java.awt.Cursor c,
boolean realSet)
c - The new cursorrealSet - true - The ZCanvas cursor and current cursor set
false - Only the current cursor setpublic void resetCursor()
|
Jazz API Documentation | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||