|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjava.util.Observable
com.transmote.nest.events.EventDispatcher
com.transmote.nest.NestSprite
com.transmote.nest.ui.NestButton
public class NestButton
NestButton provides a simple button UI element for use within the Nest framework. NestButton allows for a stroke+fill background, a text label, and a PImage to use as the background. To handle a NestButton click, the NestButton's parent should add itself as an observer to the NestButton. The MOUSE_CLICKED event will bubble up from the NestButton to its parent, where it can be handled within handleEvent(). NestSprite buttonContainer = new NestSprite(); NestButton button = new NestButton(width, height, label, font); buttonContainer.addChild(button); // ...within buttonContainer: protected void handleEvent (Event event) { if (event.target() == button && event.type() == MouseEvent.MOUSE_CLICKED) { // respond to click here } }
| Field Summary | |
|---|---|
float |
cornerRadius
Radius of corners. |
int |
fillColor_down
ARGB color of button background when button is pressed. |
int |
fillColor_up
ARGB color of button background when button is not pressed. |
int |
rectMode
As with PApplet.rect(), specifies whether to draw button from upper-left corner or from center. |
int |
strokeColor_down
ARGB color of button outline when button is pressed. |
int |
strokeColor_up
ARGB color of button outline when button is not pressed. |
int |
strokeWeight
Stroke weight of button outline. |
int |
textColor_down
ARGB color of text when button is pressed. |
int |
textColor_up
ARGB color of text when button is not pressed. |
| Fields inherited from class com.transmote.nest.NestSprite |
|---|
blendMode, boundsLeft, boundsTop, handleCaptureEvents, height, inFront, inputChildren, inputEnabled, NO_BLEND_MODE, rotationX, rotationY, rotationZ, scaleX, scaleY, scaleZ, visible, width, x, y, z |
| Constructor Summary | |
|---|---|
NestButton(float width,
float height,
String label,
PFont font)
|
|
NestButton(float width,
float height,
String label,
PFont font,
PImage icon)
|
|
NestButton(String label,
PFont font)
|
|
| Method Summary | |
|---|---|
PFont |
getFont()
Font to use for text label. |
PImage |
getIcon()
|
String |
getLabel()
Text label that appears within button. |
void |
setFont(PFont font)
Font to use for text label. |
void |
setIcon(PImage icon)
PImage to use as button. |
void |
setLabel(String label)
Text label that appears within button. |
void |
triggerClick()
Triggers a MouseEvent.MOUSE_CLICKED event, centered on the button. |
| Methods inherited from class com.transmote.nest.NestSprite |
|---|
addChild, addChild, bounds, dispatchEvent, dispose, dispose, getChildAt, getChildIndex, globalToLocal, hitTest, hitTest, isDisposed, localToGlobal, mousePt, mouseX, mouseY, numChildren, pApplet, parent, removeChild, removeChild, renderer, screenPt, screenX, screenY, setBounds, setBounds, setChildIndex, setDraw, setDraw, setRenderer, setRenderer, setUpdate, setUpdate, swapChildren, swapChildren |
| Methods inherited from class com.transmote.nest.events.EventDispatcher |
|---|
addObserver, deleteObserver, dispatchEvent, owner, update |
| Methods inherited from class java.util.Observable |
|---|
countObservers, deleteObservers, hasChanged, notifyObservers, notifyObservers |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public int textColor_up
public int textColor_down
public int fillColor_up
public int fillColor_down
public int strokeColor_up
public int strokeColor_down
public int strokeWeight
public float cornerRadius
public int rectMode
| Constructor Detail |
|---|
public NestButton(String label,
PFont font)
public NestButton(float width,
float height,
String label,
PFont font)
public NestButton(float width,
float height,
String label,
PFont font,
PImage icon)
| Method Detail |
|---|
public void setLabel(String label)
public String getLabel()
public void setFont(PFont font)
public PFont getFont()
public void setIcon(PImage icon)
public PImage getIcon()
public void triggerClick()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||