|
PulpCore | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object pulpcore.sprite.Sprite pulpcore.sprite.Group pulpcore.sprite.ScrollPane
public class ScrollPane
A ScrollPane is a Viewport
with scroll bars that appear as needed.
Note, the scroll bars' appearance is currently limited (no dynamic thumb size).
To avoid a horizontal scroll bar automatically appearing, set the width of the ScrollPane to
maxContentWidth + ScrollPane.SCROLLBAR_WIDTH
.
Field Summary | |
---|---|
static int |
SCROLLBAR_ALWAYS
The scrollbar always appears. |
static int |
SCROLLBAR_AUTO
The scrollbar always automatically as needed. |
static int |
SCROLLBAR_NEVER
The scrollbar never appears. |
static int |
SCROLLBAR_WIDTH
|
Bool |
scrollPixelSnapping
The flag to indicate pixel snapping for scroll location. |
Fixed |
scrollX
The scroll x location. |
Fixed |
scrollY
The scroll y location. |
Fields inherited from class pulpcore.sprite.Sprite |
---|
alpha, anchorX, anchorY, angle, CENTER, DEFAULT, EAST, enabled, height, NORTH, NORTH_EAST, NORTH_WEST, pixelSnapping, SOUTH, SOUTH_EAST, SOUTH_WEST, visible, WEST, width, x, y |
Constructor Summary | |
---|---|
ScrollPane(int x,
int y,
int w,
int h)
Creates a ScrollPane where both the horizontal and vertical scrollbars appear automatically as needed. |
|
ScrollPane(int x,
int y,
int w,
int h,
int verticalScrollBarAppears,
int horizontalScrollBarAppears)
Creates a ScrollPane where both the horizontal and vertical scrollbars appear according the the specified flags. |
Method Summary | |
---|---|
void |
add(int index,
Sprite sprite)
Calls add(index, sprite) on the internal Viewport . |
void |
add(Sprite sprite)
Calls add(sprite) on the internal Viewport . |
protected Button |
createDownButton()
Creates a down arrow button for the vertical scroll bar, using the default appearance. |
protected Slider |
createHorizontalScrollBar(int width)
Creates a horizontal scroll bar with the default appearance. |
protected Button |
createLeftButton()
Creates a left arrow button for the horizontal scroll bar, using the default appearance. |
protected Button |
createRightButton()
Creates a right arrow button for the vertical scroll bar, using the default appearance. |
protected Button |
createUpButton()
Creates an up arrow button for the vertical scroll bar, using the default appearance. |
protected Slider |
createVerticalScrollBar(int height)
Creates a vertical scroll bar with the default appearance. |
int |
getContentHeight()
|
Group |
getContentPane()
|
int |
getContentWidth()
|
int |
getScrollUnitSize()
Gets the amount to scroll when using the arrow keys. |
boolean |
hasFocus()
Returns true if this ScrollPane automatically reacts to keyboard events for
scrolling. |
void |
moveDown(Sprite sprite)
Calls moveDown(sprite) on the internal Viewport . |
void |
moveToBottom(Sprite sprite)
Calls moveToBottom(sprite) on the internal Viewport . |
void |
moveToTop(Sprite sprite)
Calls moveToTop(sprite) on the internal Viewport . |
void |
moveUp(Sprite sprite)
Calls moveUp(sprite) on the internal Viewport . |
void |
remove(Sprite sprite)
Calls remove(sprite) on the internal Viewport . |
void |
removeAll()
Calls removeAll() on the internal Viewport . |
void |
scrollDown()
Scrolls down one unit, if possible. |
void |
scrollEnd()
Scrolls to the bottom, if possible. |
void |
scrollHome()
Scrolls to the top, if possible. |
void |
scrollHorizontal(int units)
Scrolls horizontally by the specificed number of units, if possible. |
void |
scrollLeft()
Scrolls left one unit, if possible. |
void |
scrollLeftSide()
Scrolls to the left-most side, if possible. |
void |
scrollPageDown()
Scrolls down one page, if possible. |
void |
scrollPageLeft()
Scrolls left one page, if possible. |
void |
scrollPageRight()
Scrolls right one page, if possible. |
void |
scrollPageUp()
Scrolls up one page, if possible. |
void |
scrollRight()
Scrolls right one unit, if possible. |
void |
scrollRightSide()
Scrolls to the right-most side, if possible. |
void |
scrollUp()
Scrolls up one unit, if possible. |
void |
scrollVertical(int units)
Scrolls vertically by the specificed number of units, if possible. |
void |
setAnimationDuration(int unitDuration,
int pageDuration)
Sets the duration, in milliseconds, when scrolling. |
void |
setFocus(boolean hasFocus)
Set whether this ScrollPane automatically reacts to keyboard events for scrolling. |
void |
setScrollUnitSize(int scrollUnitSize)
Set the amount to scroll when using the arrow keys. |
void |
update(int elapsedTime)
Updates all of this Sprite's properties. |
Methods inherited from class pulpcore.sprite.Group |
---|
contains, createBackBuffer, createBackBuffer, drawSprite, findWithTag, get, getBackBuffer, getBackBufferBlendMode, getNaturalHeight, getNaturalWidth, getNumSprites, getNumVisibleSprites, getRemovedSprites, hasBackBuffer, isAncestorOf, isOverflowClipped, iterator, pack, pick, pickEnabledAndVisible, propertyChange, removeBackBuffer, setBackBufferBlendMode, size |
Methods inherited from class pulpcore.sprite.Sprite |
---|
bindLocationTo, bindSizeTo, clearCursor, clearDirtyRect, contains, draw, getBlendMode, getCursor, getDirtyRect, getFilter, getLocalX, getLocalY, getParent, getPixelLevelChecks, getRoot, getScene2D, getTag, getViewX, getViewX, getViewY, getViewY, intersects, isDirty, isEnabled, isEnabledAndVisible, isMouseDoubleClicked, isMouseDown, isMouseHover, isMouseOver, isMousePressed, isMouseReleased, isMouseTripleClicked, isMouseWheelRotated, isOpaque, isPick, isPickEnabledAndVisible, isTransparent, move, move, move, move, move, move, moveTo, moveTo, moveTo, moveTo, moveTo, moveTo, removeFromParent, scale, scale, scale, scale, scale, scale, scaleTo, scaleTo, scaleTo, scaleTo, scaleTo, scaleTo, setAnchor, setAnchor, setBlendMode, setCursor, setDirty, setFilter, setLocation, setLocation, setSize, setSize, setTag, translate, translate, updateDirtyRect |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int SCROLLBAR_WIDTH
public static final int SCROLLBAR_NEVER
public static final int SCROLLBAR_ALWAYS
public static final int SCROLLBAR_AUTO
public final Fixed scrollX
getContentPane().x
.
public final Fixed scrollY
getContentPane().y
.
public final Bool scrollPixelSnapping
true
.
Identical to getContentPane().pixelSnapping
.
Constructor Detail |
---|
public ScrollPane(int x, int y, int w, int h)
public ScrollPane(int x, int y, int w, int h, int verticalScrollBarAppears, int horizontalScrollBarAppears)
verticalScrollBarAppears
- one of SCROLLBAR_NEVER
,
SCROLLBAR_ALWAYS
, or SCROLLBAR_AUTO
.horizontalScrollBarAppears
- one of SCROLLBAR_NEVER
,
SCROLLBAR_ALWAYS
, or SCROLLBAR_AUTO
.Method Detail |
---|
public boolean hasFocus()
true
if this ScrollPane automatically reacts to keyboard events for
scrolling.
public void setFocus(boolean hasFocus)
public void update(int elapsedTime)
Sprite
update
in class Group
protected Slider createVerticalScrollBar(int height)
Subclasses may override this method to provide a custom look and feel. The location, range, and value of the Slider is set automatically.
protected Slider createHorizontalScrollBar(int width)
Subclasses may override this method to provide a custom look and feel. The location, range, and value of the Slider is set automatically.
protected Button createUpButton()
Subclasses may override this method to provide a custom look and feel, and may return null to allow no up button. The location of the Button is set automatically.
protected Button createDownButton()
Subclasses may override this method to provide a custom look and feel, and may return null to allow no down button. The location of the Button is set automatically.
protected Button createLeftButton()
Subclasses may override this method to provide a custom look and feel, and may return null to allow no left button. The location of the Button is set automatically.
protected Button createRightButton()
Subclasses may override this method to provide a custom look and feel, and may return null to allow no right button. The location of the Button is set automatically.
public void setAnimationDuration(int unitDuration, int pageDuration)
public void setScrollUnitSize(int scrollUnitSize)
public int getScrollUnitSize()
public void scrollVertical(int units)
setScrollUnitSize(int)
,
setAnimationDuration(int, int)
public void scrollHorizontal(int units)
setScrollUnitSize(int)
,
setAnimationDuration(int, int)
public void scrollHome()
public void scrollEnd()
public void scrollLeftSide()
public void scrollRightSide()
public void scrollUp()
setScrollUnitSize(int)
,
setAnimationDuration(int, int)
public void scrollDown()
setScrollUnitSize(int)
,
setAnimationDuration(int, int)
public void scrollLeft()
setScrollUnitSize(int)
,
setAnimationDuration(int, int)
public void scrollRight()
setScrollUnitSize(int)
,
setAnimationDuration(int, int)
public void scrollPageUp()
setAnimationDuration(int, int)
public void scrollPageDown()
setAnimationDuration(int, int)
public void scrollPageLeft()
setAnimationDuration(int, int)
public void scrollPageRight()
setAnimationDuration(int, int)
public Group getContentPane()
public int getContentWidth()
public int getContentHeight()
public void add(Sprite sprite)
add(sprite)
on the internal Viewport
.
Adds a Sprite to this Group. The Sprite is added so it appears above all other sprites in this Group. If this Sprite already belongs to a Group, it is first removed from that Group before added to this one.
add
in class Group
public void add(int index, Sprite sprite)
add(index, sprite)
on the internal Viewport
.
Inserts a Sprite to this Group at the specified position. The Sprite at the current position (if any) and any subsequent Sprites are moved up in the z-order (adds one to their indices).
If the index is less than zero, the sprite is inserted at position zero (the bottom in the
z-order).
If the index is greater than or equal to Group.size()
, the sprite is inserted at
position Group.size()
(the top in the z-order).
add
in class Group
public void remove(Sprite sprite)
remove(sprite)
on the internal Viewport
.
Removes a Sprite from this Group.
remove
in class Group
public void removeAll()
removeAll()
on the internal Viewport
.
Removes all Sprites from this Group.
removeAll
in class Group
public void moveToTop(Sprite sprite)
moveToTop(sprite)
on the internal Viewport
.
Moves the specified Sprite to the top of the z-order, so that all the other Sprites currently in this Group appear underneath it. If the specified Sprite is not in this Group, or the Sprite is already at the top, this method does nothing.
moveToTop
in class Group
public void moveToBottom(Sprite sprite)
moveToBottom(sprite)
on the internal Viewport
.
Moves the specified Sprite to the bottom of the z-order, so that all the other Sprites currently in this Group appear above it. If the specified Sprite is not in this Group, or the Sprite is already at the bottom, this method does nothing.
moveToBottom
in class Group
public void moveUp(Sprite sprite)
moveUp(sprite)
on the internal Viewport
.
Moves the specified Sprite up in z-order, swapping places with the first Sprite that appears above it. If the specified Sprite is not in this Group, or the Sprite is already at the top, this method does nothing.
moveUp
in class Group
public void moveDown(Sprite sprite)
moveDown(sprite)
on the internal Viewport
.
Moves the specified Sprite down in z-order, swapping places with the first Sprite that appears below it. If the specified Sprite is not in this Group, or the Sprite is already at the bottom, this method does nothing.
moveDown
in class Group
|
PulpCore | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |