|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.threerings.opengl.gui.Component
com.threerings.opengl.gui.TextComponent
com.threerings.opengl.gui.Label
com.threerings.opengl.gui.Button
public class Button
Displays a simple button that can be depressed and which generates an action event when pressed and released.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class com.threerings.opengl.gui.Label |
|---|
Label.Fit |
| Field Summary | |
|---|---|
protected String |
_action
|
protected Object |
_argument
|
protected String[] |
_feedbackSounds
|
protected boolean |
_pressed
|
protected long |
_releasedWhen
|
static int |
DOWN
Indicates that this button is in the down state. |
protected static int |
STATE_COUNT
|
protected static String[] |
STATE_PCLASSES
|
| Fields inherited from class com.threerings.opengl.gui.Label |
|---|
_label |
| Fields inherited from class com.threerings.opengl.gui.TextComponent |
|---|
_effcols, _effsizes, _haligns, _lineSpacings, _teffects, _textfacts, _valigns |
| Fields inherited from class com.threerings.opengl.gui.Component |
|---|
_alpha, _backgrounds, _borders, _colors, _ctx, _cursor, _enabled, _height, _hover, _hoverable, _insets, _listeners, _parent, _preferredSize, _properties, _rect, _styleConfigs, _tipmouse, _tiptext, _tooltipStyle, _transferHandler, _valid, _visible, _width, _x, _y, DEFAULT, DISABLED, HOVER |
| Fields inherited from interface com.threerings.opengl.gui.UIConstants |
|---|
BOTTOM, CENTER, DEFAULT_SIZE, DEFAULT_SPACING, GLOW, HORIZONTAL, LEFT, NORMAL, OUTLINE, OVERLAPPING, PLAIN, RIGHT, SHADOW, TOP, VERTICAL |
| Constructor Summary | |
|---|---|
Button(GlContext ctx,
Icon icon,
ActionListener listener,
String action)
Creates a button with the specified icon and action. |
|
Button(GlContext ctx,
Icon icon,
ActionListener listener,
String action,
Object argument)
Creates a button with the specified icon, action, and argument. |
|
Button(GlContext ctx,
Icon icon,
String action)
Creates a button with the specified icon and action. |
|
Button(GlContext ctx,
Icon icon,
String action,
Object argument)
Creates a button with the specified icon, action, and argument. |
|
Button(GlContext ctx,
String text)
Creates a button with the specified textual label. |
|
Button(GlContext ctx,
String text,
ActionListener listener,
String action)
Creates a button with the specified label and action. |
|
Button(GlContext ctx,
String text,
ActionListener listener,
String action,
Object argument)
Creates a button with the specified label, action, and argument. |
|
Button(GlContext ctx,
String text,
String action)
Creates a button with the specified label and action. |
|
Button(GlContext ctx,
String text,
String action,
Object argument)
Creates a button with the specified label, action, and argument. |
|
| Method Summary | |
|---|---|
boolean |
dispatchEvent(Event event)
Instructs this component to process the supplied event. |
void |
doClick()
Programmatically activates the button. |
protected void |
fireAction(long when,
int modifiers)
Called when the button is "clicked" which may due to the mouse being pressed and released while over the button or due to keyboard manipulation while the button has focus. |
String |
getAction()
Returns the action generated when this button is clicked. |
Object |
getArgument()
Get the argument dispatched by this button. |
protected String |
getDefaultStyleConfig()
Returns the name of the default config to be used for all instances of this component. |
String |
getFeedbackSound()
Returns a reference to the feedback sound used by this component. |
int |
getState()
Returns the state of this component, either Component.DEFAULT or Component.DISABLED. |
protected int |
getStateCount()
Returns the number of different states that this component can take. |
protected String |
getStatePseudoClass(int state)
Returns the pseudoclass identifier for the specified component state. |
protected void |
playFeedbackSound()
Plays the feedback sound, if any. |
void |
setAction(String action)
Configures the action to be generated when this button is clicked. |
void |
setArgument(Object argument)
Set the argument dispatched by this button. |
protected void |
updateFromStyleConfig(int state,
StyleConfig.Original config)
Updates from the resolved style config. |
| Methods inherited from class com.threerings.opengl.gui.Label |
|---|
computePreferredSize, getFit, getIcon, getIconTextGap, getLabelRenderer, getText, layout, renderComponent, setFit, setIcon, setIconTextGap, setOrientation, setPreferredWidth, setText, setTextRotation |
| Methods inherited from class com.threerings.opengl.gui.TextComponent |
|---|
getEffectColor, getEffectSize, getHorizontalAlignment, getLabelRendererConfig, getLineSpacing, getTextEffect, getTextFactory, getTextFactory, getVerticalAlignment |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int DOWN
protected boolean _pressed
protected long _releasedWhen
protected String _action
protected Object _argument
protected String[] _feedbackSounds
protected static final int STATE_COUNT
protected static final String[] STATE_PCLASSES
| Constructor Detail |
|---|
public Button(GlContext ctx,
String text)
public Button(GlContext ctx,
String text,
String action)
ActionEvent when the button is
clicked.
public Button(GlContext ctx,
String text,
String action,
Object argument)
public Button(GlContext ctx,
String text,
ActionListener listener,
String action)
ActionEvent to the specified ActionListener when the button is clicked.
public Button(GlContext ctx,
String text,
ActionListener listener,
String action,
Object argument)
public Button(GlContext ctx,
Icon icon,
String action)
ActionEvent when the button is clicked.
public Button(GlContext ctx,
Icon icon,
String action,
Object argument)
public Button(GlContext ctx,
Icon icon,
ActionListener listener,
String action)
ActionEvent to the specified ActionListener when the button is clicked.
public Button(GlContext ctx,
Icon icon,
ActionListener listener,
String action,
Object argument)
| Method Detail |
|---|
public void setAction(String action)
public String getAction()
public void setArgument(Object argument)
public Object getArgument()
public String getFeedbackSound()
public void doClick()
public int getState()
ComponentComponent.DEFAULT or Component.DISABLED.
getState in class Componentpublic boolean dispatchEvent(Event event)
Componentsuper.dispatchEvent for events that they did not "consume".
dispatchEvent in class Componentprotected String getDefaultStyleConfig()
Component
getDefaultStyleConfig in class Labelprotected int getStateCount()
Component
getStateCount in class Componentprotected String getStatePseudoClass(int state)
ComponentComponent.DISABLED state maps to disabled and is configured like so:
component:disabled {
color: #CCCCCC; // etc.
}
getStatePseudoClass in class Component
protected void updateFromStyleConfig(int state,
StyleConfig.Original config)
Component
updateFromStyleConfig in class TextComponent
protected void fireAction(long when,
int modifiers)
protected void playFeedbackSound()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||