public final class VerticalRibbon
extends org.piccolo2d.PNode
Displays an image textured/repeated vertically for the entire height of a Piccolo2D camera view. The anchor for the textured image can be moved up or down using a cursor position and distance unit to indicate scrolling or movement.
Animate the ribbon by calling the advance() method
at regular intervals, using either the Swing timer
final VerticalRibbon ribbon = new VerticalRibbon(...);
Timer t = new Timer(100, new ActionListener()
{
public void actionPerformed(final ActionEvent event)
{
ribbon.advance();
}
});
t.setRepeats(true);
t.start();
or the Piccolo2D activity framework
final PRoot root = ...;
final VerticalRibbon ribbon = new VerticalRibbon(...);
PActivity activity = new PActivity()
{
protected void activityStep(final long elapsedTime)
{
ribbon.advance();
}
};
root.addActivity(activity);
| Modifier and Type | Field and Description |
|---|---|
(package private) static double |
DEFAULT_CURSOR
Default cursor.
|
(package private) static double |
DEFAULT_DISTANCE
Default distance unit.
|
FILL_STRATEGY_ASPECT_COVER, FILL_STRATEGY_ASPECT_FIT, FILL_STRATEGY_EXACT_FIT, PROPERTY_BOUNDS, PROPERTY_CHILDREN, PROPERTY_CHILDREN_PICKABLE, PROPERTY_CLIENT_PROPERTIES, PROPERTY_CODE_BOUNDS, PROPERTY_CODE_CHILDREN, PROPERTY_CODE_CHILDREN_PICKABLE, PROPERTY_CODE_CLIENT_PROPERTIES, PROPERTY_CODE_FULL_BOUNDS, PROPERTY_CODE_PAINT, PROPERTY_CODE_PARENT, PROPERTY_CODE_PICKABLE, PROPERTY_CODE_TRANSFORM, PROPERTY_CODE_TRANSPARENCY, PROPERTY_CODE_VISIBLE, PROPERTY_FULL_BOUNDS, PROPERTY_PAINT, PROPERTY_PARENT, PROPERTY_PICKABLE, PROPERTY_TRANSFORM, PROPERTY_TRANSPARENCY, PROPERTY_VISIBLE, SCENE_GRAPH_DELEGATENO_SUCH_PAGE, PAGE_EXISTS| Constructor and Description |
|---|
VerticalRibbon(BufferedImage image)
Create a new vertical ribbon for the specified image.
|
VerticalRibbon(BufferedImage image,
double cursor,
double distance)
Create a new vertical ribbon for the specified image
with the specified cursor and distance unit.
|
| Modifier and Type | Method and Description |
|---|---|
void |
advance()
Advance this vertical ribbon one animation frame.
|
(package private) double |
getCursor()
Return the cursor for this vertical ribbon.
|
double |
getDistance()
Return the distance unit in user space coordinates for this
vertical ribbon.
|
boolean |
isMovingDown()
Return true if this vertical ribbon is moving down when animating.
|
boolean |
isMovingUp()
Return true if this vertical ribbon is moving up when animating.
|
boolean |
isNotMoving()
Return true if this vertical ribbon is not moving when animating.
|
void |
moveDown()
Set this vertical ribbon to move down when animating.
|
void |
moveUp()
Set this vertical ribbon to move up when animating.
|
protected void |
paint(org.piccolo2d.util.PPaintContext paintContext) |
void |
pause()
Set this vertical ribbon not to move when animating.
|
void |
setDistance(double distance)
Set the distance unit in user space coordinates for this
vertical ribbon to
distance. |
addActivity, addAttribute, addChild, addChild, addChildren, addInputEventListener, addPropertyChangeListener, addPropertyChangeListener, animateToBounds, animateToColor, animateToPositionScaleRotation, animateToRelativePosition, animateToTransform, animateToTransparency, animateTransformToBounds, centerBoundsOnPoint, centerFullBoundsOnPoint, clone, computeFullBounds, endResizeBounds, findIntersectingNodes, fireChildPropertyChange, firePropertyChange, fullIntersects, fullPaint, fullPick, getAllNodes, getAllNodes, getAttribute, getAttribute, getBooleanAttribute, getBounds, getBoundsChanged, getBoundsReference, getBoundsVolatile, getChild, getChildBoundsInvalid, getChildBoundsVolatile, getChildPaintInvalid, getChildrenCount, getChildrenIterator, getChildrenPickable, getChildrenReference, getClientProperties, getClientPropertyKeysEnumeration, getDoubleAttribute, getFullBounds, getFullBoundsInvalid, getFullBoundsReference, getGlobalBounds, getGlobalFullBounds, getGlobalRotation, getGlobalScale, getGlobalToLocalTransform, getGlobalTranslation, getHeight, getInputEventListeners, getIntegerAttribute, getInverseTransform, getListenerList, getLocalToGlobalTransform, getName, getOccluded, getOffset, getPaint, getPaintInvalid, getParent, getPickable, getPropertyChangeParentMask, getRoot, getRotation, getScale, getTransform, getTransformReference, getTransparency, getUnionOfChildrenBounds, getVisible, getWidth, getX, getXOffset, getY, getYOffset, globalToLocal, globalToLocal, globalToLocal, indexOfChild, internalUpdateBounds, intersects, invalidateFullBounds, invalidateLayout, invalidatePaint, isAncestorOf, isDescendentOf, isDescendentOfRoot, isOpaque, layoutChildren, lerp, localToGlobal, localToGlobal, localToGlobal, localToParent, localToParent, localToParent, lower, lower, lowerBelow, lowerToBottom, lowerToBottom, offset, paintAfterChildren, parentBoundsChanged, parentToLocal, parentToLocal, parentToLocal, pick, pickAfterChildren, print, print, raise, raise, raiseAbove, raiseToTop, raiseToTop, removeAllChildren, removeChild, removeChild, removeChildren, removeFromParent, removeInputEventListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaintFrom, reparent, replaceWith, resetBounds, rotate, rotateAboutPoint, rotateAboutPoint, rotateInPlace, scale, scaleAboutPoint, scaleAboutPoint, setBounds, setBounds, setBoundsChanged, setChildBoundsInvalid, setChildBoundsVolatile, setChildPaintInvalid, setChildrenPickable, setFullBoundsInvalid, setGlobalRotation, setGlobalScale, setGlobalTranslation, setHeight, setName, setOccluded, setOffset, setOffset, setPaint, setPaintInvalid, setParent, setPickable, setPropertyChangeParentMask, setRotation, setScale, setTransform, setTransparency, setVisible, setWidth, setX, setY, signalBoundsChanged, startResizeBounds, toImage, toImage, toImage, toImage, transformBy, translate, validateFullBounds, validateFullPaintstatic final double DEFAULT_CURSOR
static final double DEFAULT_DISTANCE
public VerticalRibbon(BufferedImage image)
image - image for this vertical ribbon, must not be nullpublic VerticalRibbon(BufferedImage image, double cursor, double distance)
image - image for this vertical ribbon, must not be nullcursor - cursor position for this horizontal ribbondistance - distance unit for this horizontal ribbonpublic void pause()
public boolean isNotMoving()
public void moveUp()
public boolean isMovingUp()
public void moveDown()
public boolean isMovingDown()
public void advance()
public double getDistance()
advance() will
increment or decrement the cursor position for this vertical
ribbon by the factor of this distance unit and the last scale
factor recorded by the paint(PPaintContext) method.advance()public void setDistance(double distance)
distance.
This is a bound property.
distance - distance unit for this vertical ribbondouble getCursor()
protected void paint(org.piccolo2d.util.PPaintContext paintContext)
paint in class org.piccolo2d.PNodeCopyright (c) 2006-2013 held jointly by the individual authors. Licensed under the GNU Lesser General Public License (LGPL).