|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.threerings.media.AbstractMedia
com.threerings.media.sprite.Sprite
com.threerings.media.sprite.ButtonSprite
public class ButtonSprite
A sprite that acts as a button.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class com.threerings.media.sprite.Sprite |
|---|
Sprite.CancelledOp, Sprite.CompletedOp |
| Field Summary | |
|---|---|
protected String |
_actionCommand
The action command generated by this button. |
protected Color |
_alternateColor
The alternate (outline) color of this sprite. |
protected int |
_arcHeight
The height of the corner arcs for rounded rectangle buttons. |
protected int |
_arcWidth
The width of the corner arcs for rounded rectangle buttons. |
protected Color |
_backgroundColor
The background color of this sprite. |
protected Object |
_commandArgument
The command argument generated by this button. |
protected boolean |
_enabled
Whether or not the button is currently enabled. |
protected Label |
_label
The label associated with this sprite. |
protected boolean |
_pressed
Whether or not the button is currently pressed. |
protected int |
_style
The button style. |
static int |
NORMAL
The normal, square button style. |
protected static int |
PADDING
The number of pixels to add between the text and the border. |
static int |
ROUNDED
The rounded button style. |
| Fields inherited from class com.threerings.media.sprite.Sprite |
|---|
_orient, _ox, _oxoff, _oy, _oyoff, _path, _pathStamp |
| Fields inherited from class com.threerings.media.AbstractMedia |
|---|
_bounds, _firstTick, _mgr, _observers, _renderOrder, HUD_LAYER |
| Fields inherited from interface com.threerings.util.DirectionCodes |
|---|
CARDINAL_DIRECTIONS, CCW, CW, DIRECTION_COUNT, DOWN, EAST, EASTNORTHEAST, EASTSOUTHEAST, FINE_DIRECTION_COUNT, HORIZONTAL, LEFT, NONE, NORTH, NORTHEAST, NORTHNORTHEAST, NORTHNORTHWEST, NORTHWEST, RIGHT, SOUTH, SOUTHEAST, SOUTHSOUTHEAST, SOUTHSOUTHWEST, SOUTHWEST, UP, VERTICAL, WEST, WESTNORTHWEST, WESTSOUTHWEST |
| Constructor Summary | |
|---|---|
ButtonSprite(Label label,
int style,
Color backgroundColor,
Color alternateColor,
String actionCommand,
Object commandArgument)
Constructs a button sprite. |
|
ButtonSprite(Label label,
int style,
int arcWidth,
int arcHeight,
Color backgroundColor,
Color alternateColor,
String actionCommand,
Object commandArgument)
Constructs a button sprite. |
|
| Method Summary | |
|---|---|
String |
getActionCommand()
|
int |
getArcHeight()
Returns the arc height for rounded buttons. |
int |
getArcWidth()
Returns the arc width for rounded buttons. |
Color |
getBackgroundColor()
Returns the background color of this button. |
Object |
getCommandArgument()
|
Label |
getLabel()
Returns a reference to the label displayed by this sprite. |
int |
getStyle()
Returns the style of this button. |
protected void |
init()
Called when the media has had its manager set. |
boolean |
isArmed()
Checks whether or not this button appears pressed. |
boolean |
isEnabled()
|
void |
paint(Graphics2D gfx)
Called by the appropriate manager to request that the media render itself with the given graphics context. |
void |
setActionCommand(String actionCommand)
Sets the action command generated by this button. |
void |
setArcHeight(int arcHeight)
Sets the arc height for rounded buttons. |
void |
setArcWidth(int arcWidth)
Sets the arc width for rounded buttons. |
void |
setArmed(boolean pressed)
Render this sprite such that is is drawn "armed". |
void |
setBackgroundColor(Color backgroundColor)
Sets the background color of this button. |
void |
setCommandArgument(Object commandArgument)
Sets the command argument generated by this button. |
void |
setEnabled(boolean enabled)
Sets whether or not this button is enabled. |
void |
setStyle(int style)
Sets the style of this button. |
void |
updateBounds()
Updates this sprite's bounds after a change to the label. |
| Methods inherited from class com.threerings.media.sprite.Sprite |
|---|
addSpriteObserver, cancelMove, contains, fastForward, getHeight, getOrientation, getPath, getWidth, getX, getXOffset, getY, getYOffset, hitTest, inside, intersects, isMoving, move, paintPath, pathBeginning, pathCompleted, removeSpriteObserver, setLocation, setOrientation, shutdown, tick, tickPath, toString, updateRenderOrigin, viewLocationDidChange |
| Methods inherited from class com.threerings.media.AbstractMedia |
|---|
addObserver, contains, contains, contains, contains, getBounds, getBounds2D, getPathIterator, getPathIterator, getRenderOrder, init, intersects, intersects, invalidate, invalidateAfterChange, naturalCompareTo, queueNotification, removeObserver, renderCompareTo, setRenderOrder, toString, willStart |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface com.threerings.media.util.Pathable |
|---|
getBounds |
| Field Detail |
|---|
public static final int NORMAL
public static final int ROUNDED
protected static final int PADDING
protected Label _label
protected int _style
protected int _arcWidth
protected int _arcHeight
protected String _actionCommand
protected Object _commandArgument
protected Color _backgroundColor
protected Color _alternateColor
protected boolean _enabled
protected boolean _pressed
| Constructor Detail |
|---|
public ButtonSprite(Label label,
int style,
Color backgroundColor,
Color alternateColor,
String actionCommand,
Object commandArgument)
label - the label to render on the buttonstyle - the style of button to render (NORMAL or ROUNDED)backgroundColor - the background color of the buttonalternateColor - the alternate (outline) coloractionCommand - the button's commandcommandArgument - the button's command argument
public ButtonSprite(Label label,
int style,
int arcWidth,
int arcHeight,
Color backgroundColor,
Color alternateColor,
String actionCommand,
Object commandArgument)
label - the label to render on the buttonstyle - the style of button to render (NORMAL or ROUNDED)arcWidth - the width of the corner arcs for rounded buttonsarcHeight - the height of the corner arcs for rounded buttonsbackgroundColor - the background color of the buttonalternateColor - the alternate (outline) coloractionCommand - the button's commandcommandArgument - the button's command argument| Method Detail |
|---|
public Label getLabel()
public void updateBounds()
public void setStyle(int style)
public int getStyle()
public void setArcWidth(int arcWidth)
public int getArcWidth()
public void setArcHeight(int arcHeight)
public int getArcHeight()
public void setBackgroundColor(Color backgroundColor)
public Color getBackgroundColor()
public void setActionCommand(String actionCommand)
public String getActionCommand()
getActionCommand in interface ActionSpritepublic void setCommandArgument(Object commandArgument)
public Object getCommandArgument()
getCommandArgument in interface CommandSpritepublic void setEnabled(boolean enabled)
public boolean isEnabled()
isEnabled in interface DisableableSpritepublic void setArmed(boolean pressed)
ArmingSprite
setArmed in interface ArmingSpritepublic boolean isArmed()
protected void init()
AbstractMediasuper.init().
init in class AbstractMediapublic void paint(Graphics2D gfx)
AbstractMedia
paint in class Sprite
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||