edu.umd.cs.jazz.component
Class ZSwing
java.lang.Object
|
+--edu.umd.cs.jazz.ZSceneGraphObject
|
+--edu.umd.cs.jazz.ZVisualComponent
|
+--edu.umd.cs.jazz.component.ZSwing
- All Implemented Interfaces:
- java.io.Serializable, ZSerializable
- public class ZSwing
- extends ZVisualComponent
- implements java.io.Serializable
ZSwing is a Visual Component wrapper used to add
Swing Components to a Jazz ZCanvas
- See Also:
- Serialized Form
|
Field Summary |
protected float |
renderCutoff
The cutoff at which the Swing component is rendered greek |
static java.lang.String |
VISUAL_COMPONENT_KEY
Used as a hashtable key for this object in the Swing component's
client properties. |
|
Constructor Summary |
ZSwing(ZCanvas zbc,
javax.swing.JComponent component)
Constructs a new visual component wrapper for the Swing component
and adds the Swing component to the SwingWrapper component of
the ZCanvas |
|
Method Summary |
void |
computeBounds()
Sets the Swing component's bounds to its preferred bounds
unless it already is set to its preferred size. |
javax.swing.JComponent |
getComponent()
Returns the Swing component that this visual component wraps |
void |
paint(java.awt.Graphics2D g2)
Forwards the paint request to the Swing component to paint normally |
void |
paintAsGreek(java.awt.Graphics2D g2)
Paints the Swing component as greek. |
void |
render(ZRenderContext renderContext)
Determines if the Swing component should be rendered normally or
as a filled rectangle (Greek?). |
void |
repaint(ZBounds repaintBounds)
Repaint's the specified portion of this visual component
Note that the input parameter may be modified as a result of this call. |
| Methods inherited from class edu.umd.cs.jazz.ZVisualComponent |
boundsUpdated,
clone,
duplicateObject,
getParents,
pick,
pickBounds,
repaint,
setState,
trimToSize,
updateBounds,
updateVolatility,
writeObject,
writeObjectRecurse |
| Methods inherited from class java.lang.Object |
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
renderCutoff
protected float renderCutoff
- The cutoff at which the Swing component is rendered greek
VISUAL_COMPONENT_KEY
public static final java.lang.String VISUAL_COMPONENT_KEY
- Used as a hashtable key for this object in the Swing component's
client properties.
ZSwing
public ZSwing(ZCanvas zbc,
javax.swing.JComponent component)
- Constructs a new visual component wrapper for the Swing component
and adds the Swing component to the SwingWrapper component of
the ZCanvas
- Parameters:
zbc - The ZCanvas to which the Swing component will
be addedcomponent - The swing component to be wrapped
render
public void render(ZRenderContext renderContext)
- Determines if the Swing component should be rendered normally or
as a filled rectangle (Greek?).
The transform, clip, and composite will be set appropriately when this object
is rendered. It is up to this object to restore the transform, clip, and composite of
the Graphics2D if this node changes any of them. However, the color, font, and stroke are
unspecified by Jazz. This object should set those things if they are used, but
they do not need to be restored.
- Overrides:
- render in class ZVisualComponent
- Parameters:
renderContext - Contains information about current render.
paintAsGreek
public void paintAsGreek(java.awt.Graphics2D g2)
- Paints the Swing component as greek.
- Parameters:
g2 - The graphics used to render the filled rectangle
paint
public void paint(java.awt.Graphics2D g2)
- Forwards the paint request to the Swing component to paint normally
- Overrides:
- paint in class ZVisualComponent
- Parameters:
g2 - The graphics this visual component should pass to the Swing
component
repaint
public void repaint(ZBounds repaintBounds)
- Repaint's the specified portion of this visual component
Note that the input parameter may be modified as a result of this call.
- Overrides:
- repaint in class ZVisualComponent
- Parameters:
repaintBounds - The bounding box to repaint within this component
computeBounds
public void computeBounds()
- Sets the Swing component's bounds to its preferred bounds
unless it already is set to its preferred size. Also
updates the visual components copy of these bounds
- Overrides:
- computeBounds in class ZSceneGraphObject
getComponent
public javax.swing.JComponent getComponent()
- Returns the Swing component that this visual component wraps
- Returns:
- The Swing component that this visual component wraps