public class CDynamicWidget extends CWidget implements java.lang.Runnable
A widget shape for use with an Canvas
.
Like any other canvas shape type, it can be rendered in a smcanvas and interaction
with it can be described in a state machine.
It is built on any JComponent and, thus, can have its own listener.
WARNING: The underlying widget is repeatedly refreshed. You should use a CWidget
if your widget is a static widget such as a button.
Constructor and Description |
---|
CDynamicWidget(javax.swing.JComponent w)
Builds a
CDynamicWidget based on a swing component. |
CDynamicWidget(javax.swing.JComponent w,
double x,
double y,
double width,
double height,
int delayInMilliseconds)
Builds a
CDynamicWidget based on a swing component. |
CDynamicWidget(javax.swing.JComponent w,
double x,
double y,
int delayInMilliseconds)
Builds a
CDynamicWidget based on a swing component. |
Modifier and Type | Method and Description |
---|---|
int |
getDelayInMilliseconds() |
void |
paint(java.awt.Graphics g)
Paints the shape.
|
void |
run() |
void |
setDelayInMilliseconds(int delayInMilliseconds)
Sets the refreshing delay of this
CDynamicWidget . |
CElement |
widgetChanged()
Requests a refresh of the
CWidget . |
copyTo, duplicate, getWidget, isBasicListener, setBasicListener, setFillPaint
above, aboveAll, addChild, addGhost, addTag, addTag, addTag, addTo, animate, asEllipse, asImage, asPolyLine, asRectangle, asRectangularShape, asText, attachSM, below, belowAll, canvasToShape, canvasToShapeRef, clone, contains, contains, contains, contains, detachSM, duplicateWithTags, firstShape, fixReferenceShapeToCurrent, getAbsShape, getAbsTransform, getAntialiasedShapes, getBoundingBox, getCanvas, getCenterX, getCenterY, getChild, getChildren, getChildrenCount, getClip, getFilledShapes, getFillPaint, getFirstAntialiasedShape, getFirstFilledShape, getFirstHavingTag, getFirstOutlinedShape, getGhost, getHeight, getHierarchy, getIntersection, getMaxX, getMaxY, getMinX, getMinY, getOutlinedShapes, getOutlinePaint, getParent, getReferenceX, getReferenceY, getRenderingHint, getRotation, getScaleX, getScaleY, getShape, getStroke, getSubtraction, getTags, getTransform, getTranslateX, getTranslateY, getTransparencyFill, getTransparencyOutline, getWidth, hasTag, hasTag, indexOf, intersects, isAbove, isAntialiased, isBelow, isDrawable, isFilled, isOnOutline, isOutlined, isPickable, isPicked, pick, pickStyle, remove, removeAllChildren, removeChild, removeChild, removeGhost, removeTag, removeTag, rotateBy, rotateTo, scaleBy, scaleBy, scaleTo, scaleTo, setAntialiased, setClip, setDrawable, setFilled, setOutlined, setOutlinePaint, setParent, setPickable, setReferencePoint, setReferencePoint, setRenderingHint, setShape, setStroke, setTransformToIdentity, setTransparencyFill, setTransparencyFill, setTransparencyOutline, setTransparencyOutline, shapeToCanvas, translateBy, translateTo
public CDynamicWidget(javax.swing.JComponent w, double x, double y, double width, double height, int delayInMilliseconds)
CDynamicWidget
based on a swing component.w
- The component.x
- The x coordinate of the upper left point of the bounding box.y
- The y coordinate of the upper left point of the bounding box.width
- The width of the bounding box.height
- The height of the bounding box.delayInMilliseconds
- The refreshing ratepublic CDynamicWidget(javax.swing.JComponent w, double x, double y, int delayInMilliseconds)
CDynamicWidget
based on a swing component.w
- The component.x
- The x coordinate of the upper left point of the bounding box.y
- The y coordinate of the upper left point of the bounding box.delayInMilliseconds
- The refreshing ratepublic CDynamicWidget(javax.swing.JComponent w)
CDynamicWidget
based on a swing component.w
- The component.public int getDelayInMilliseconds()
public void setDelayInMilliseconds(int delayInMilliseconds)
CDynamicWidget
.delayInMilliseconds
- The delay in millisecondspublic CElement widgetChanged()
CWidget
.
Actually, a CWidget
is repainted only when
an input event ocuurs on it.widgetChanged
in class CWidget
CWidget
.public void paint(java.awt.Graphics g)
public void run()
run
in interface java.lang.Runnable