|
|||||||||
| 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.ZBasicComponent
A ZBasicComponent 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).
| Inner classes inherited from class javax.swing.JComponent |
javax.swing.JComponent.AccessibleJComponent |
| Field Summary | |
protected ZCamera |
camera
The camera in the scenegraph |
protected ZNode |
layer
The single node that camera looks onto. |
protected ZRootNode |
root
The root of the scenegraph |
protected ZSurface |
surface
The surface associated with the component |
| 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 | |
ZBasicComponent()
The default constructor for a ZBasicComponent. |
|
ZBasicComponent(ZRootNode aRoot,
ZNode layer)
A constructor for a ZBasicComponent that uses an existing scenegraph. |
|
| Method Summary | |
ZCamera |
getCamera()
Return the camera associated with the primary surface. |
ZNode |
getLayer()
Return the "layer". |
ZRootNode |
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. |
ZSurface |
getSurface()
Return the surface. |
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 |
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 |
setLayer(ZNode aLayer)
Sets the layer. |
void |
setRoot(ZRootNode aRoot)
Sets the root. |
void |
setSurface(ZSurface aSurface)
Sets the surface. |
| Methods inherited from class javax.swing.JComponent |
addAncestorListener,
addNotify,
addPropertyChangeListener,
addVetoableChangeListener,
computeVisibleRect,
contains,
createToolTip,
firePropertyChange,
firePropertyChange,
firePropertyChange,
firePropertyChange,
firePropertyChange,
firePropertyChange,
firePropertyChange,
firePropertyChange,
firePropertyChange,
fireVetoableChange,
getAccessibleContext,
getActionForKeyStroke,
getAlignmentX,
getAlignmentY,
getAutoscrolls,
getBorder,
getBounds,
getClientProperty,
getComponentGraphics,
getConditionForKeyStroke,
getDebugGraphicsOptions,
getGraphics,
getHeight,
getInsets,
getInsets,
getLocation,
getMaximumSize,
getMinimumSize,
getNextFocusableComponent,
getPreferredSize,
getRegisteredKeyStrokes,
getRootPane,
getSize,
getToolTipLocation,
getToolTipText,
getToolTipText,
getTopLevelAncestor,
getUIClassID,
getVisibleRect,
getWidth,
getX,
getY,
grabFocus,
hasFocus,
isDoubleBuffered,
isFocusCycleRoot,
isLightweightComponent,
isManagingFocus,
isOpaque,
isOptimizedDrawingEnabled,
isPaintingTile,
isRequestFocusEnabled,
isValidateRoot,
paint,
paintBorder,
paintChildren,
paintImmediately,
paintImmediately,
paramString,
processComponentKeyEvent,
processFocusEvent,
processKeyEvent,
processMouseMotionEvent,
putClientProperty,
registerKeyboardAction,
registerKeyboardAction,
removeAncestorListener,
removeNotify,
removePropertyChangeListener,
removeVetoableChangeListener,
repaint,
repaint,
requestDefaultFocus,
requestFocus,
resetKeyboardActions,
reshape,
revalidate,
scrollRectToVisible,
setAlignmentX,
setAlignmentY,
setAutoscrolls,
setBorder,
setDebugGraphicsOptions,
setDoubleBuffered,
setEnabled,
setFont,
setForeground,
setMaximumSize,
setMinimumSize,
setNextFocusableComponent,
setOpaque,
setPreferredSize,
setRequestFocusEnabled,
setToolTipText,
setUI,
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,
print,
printComponents,
processContainerEvent,
processEvent,
remove,
remove,
removeAll,
removeContainerListener,
setLayout,
validate,
validateTree |
| Methods inherited from class java.awt.Component |
action,
add,
addComponentListener,
addFocusListener,
addInputMethodListener,
addKeyListener,
addMouseListener,
addMouseMotionListener,
addPropertyChangeListener,
bounds,
checkImage,
checkImage,
coalesceEvents,
contains,
createImage,
createImage,
disable,
disableEvents,
dispatchEvent,
enable,
enable,
enableEvents,
enableInputMethods,
getBackground,
getBounds,
getColorModel,
getComponentOrientation,
getCursor,
getDropTarget,
getFont,
getFontMetrics,
getForeground,
getInputContext,
getInputMethodRequests,
getLocale,
getLocation,
getLocationOnScreen,
getName,
getParent,
getPeer,
getSize,
getToolkit,
getTreeLock,
gotFocus,
handleEvent,
hide,
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,
printAll,
processComponentEvent,
processInputMethodEvent,
processMouseEvent,
remove,
removeComponentListener,
removeFocusListener,
removeInputMethodListener,
removeKeyListener,
removeMouseListener,
removeMouseMotionListener,
removePropertyChangeListener,
repaint,
repaint,
repaint,
resize,
resize,
setBounds,
setComponentOrientation,
setCursor,
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 ZRootNode root
protected ZCamera camera
protected ZSurface surface
protected ZNode layer
| Constructor Detail |
public ZBasicComponent()
getRoot(),
getSurface(),
getCamera(),
getLayer()
public ZBasicComponent(ZRootNode aRoot,
ZNode 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(),
getSurface(),
getCamera(),
getLayer()| Method Detail |
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 setSurface(ZSurface aSurface)
surface - the surfacepublic ZSurface getSurface()
public void setCamera(ZCamera aCamera)
camera - the camerapublic ZCamera getCamera()
public void setRoot(ZRootNode aRoot)
root - the rootpublic ZRootNode getRoot()
public void setLayer(ZNode aLayer)
layer - the layerpublic ZNode 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 image
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||