public class nUIButtonElement extends nUIElementDisplay implements IButtonElement
Modifier and Type | Field and Description |
---|---|
static int |
TYPE_DEFAULT |
static int |
TYPE_LIST |
Y_IDENTIFIER_PREV_BOTTOM
COLOR_BACKGROUND_NORMAL, COLOR_BLACK, COLOR_FOREGROUND_DARK, COLOR_FOREGROUND_LIGHT, COLOR_FOREGROUND_NORMAL, COLOR_TRANSPARENT, COLOR_WHITE, DIMENSIONS_IDENTIFIER_PARENT_DIMENSIONS
Constructor and Description |
---|
nUIButtonElement() |
nUIButtonElement(java.util.Hashtable properties) |
nUIButtonElement(java.lang.String text) |
nUIButtonElement(java.lang.String text,
java.util.Hashtable properties) |
Modifier and Type | Method and Description |
---|---|
boolean |
getFocusable()
Gets whether or not this object is focusable.
|
int |
getFontStyle()
Gets the current font style used for text on this button.
|
int |
getGroupID()
Gets the current group that this button belongs to.
|
int |
getNumstates()
Gets the current number of states that this button can be in.
|
int |
getState()
Gets the current state of this button.
|
java.lang.String |
getText()
Gets the text used to label this button.
|
int |
getTextalign()
Gets the current horizontal text alignment.
|
int |
getTextColor()
Gets the current text color used for this button element.
|
int |
getType()
Gets the current button type.
|
void |
setFontSize(float points)
Sets font size in density-independent or scale-independent pixels depending on target device.
|
void |
setFontStyle(int font_style)
Sets the style of the font to use.
|
void |
setGroupID(int group_id)
Sets the group ID of this button.
Groups start from 0 and go upwards. |
void |
setNumstates(int numstates)
Sets the number of states that this button has.
|
void |
setState(int state)
Sets the current state of this button.
|
void |
setText(java.lang.String text)
Sets the text to display.
|
void |
setTextalign(int textalign)
Sets the text horizontal alignment.
|
void |
setTextColor(int text_color)
Sets the text color.
|
void |
setType(int type)
Sets the button type.
|
applyBackground, applyBackground, applyBackground
getBackgroundDrawable, getBottom, getElementIdentifier, getGesturable, getHeight, getInnerHeight, getInnerWidth, getInnerX, getInnerY, getLeft, getMaxChildX, getMaxChildY, getProperties, getProperty, getRight, getScreenInnerX, getScreenInnerY, getScreenX, getScreenY, getTop, getTopLevelParentView, getTopLevelParentWindow, getTriggerable, getWidth, getX, getY, insertAtInternal, isEnabled, isVisible, onRemoved, remove, setBackgroundDrawable, setBottom, setElementIdentifier, setEnabled, setFocusable, setGesturable, setHeight, setInnerHeight, setInnerWidth, setInnerX, setInnerY, setLeft, setProperties, setProperty, setRight, setTop, setTriggerable, setVisible, setWidth, setX, setY
add, addEventListener, childElementAt, childIndexOf, getFirstChild, getId, getLastChild, getNextSibling, getParent, getPrevSibling, getTag, insertAfter, insertAt, insertBefore, outputChildHierarchy, remove, removeEventListener, replace, replace, setId, setTag, setUnlinkChildrenOnRemoval
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
isEnabled, setEnabled
setBackgroundDrawable
public static final int TYPE_DEFAULT
public static final int TYPE_LIST
public nUIButtonElement()
public nUIButtonElement(java.lang.String text)
public nUIButtonElement(java.util.Hashtable properties)
public nUIButtonElement(java.lang.String text, java.util.Hashtable properties)
public boolean getFocusable()
nUIDisplayObject
getFocusable
in class nUIDisplayObject
public void setType(int type)
type
- the button type.java.lang.IllegalArgumentException
- if the button type is not valid.public int getType()
public void setText(java.lang.String text)
setText
in interface ITextfieldElement
text
- Text to displayjava.lang.NullPointerException
- if text is nullpublic java.lang.String getText()
getText
in interface ITextfieldElement
public void setTextalign(int textalign)
textalign
- Horizontal text alignmentjava.lang.IllegalArgumentException
- if textalign is not nUIConstants.left, center or rightpublic int getTextalign()
nUIConstants
.public void setGroupID(int group_id)
group_id
- the group id of this button, or -1 for "ungrouped".public int getGroupID()
public void setState(int state)
state
- State valuejava.lang.IllegalArgumentException
- if state is less than 0 or greater than or equal to numstatespublic int getState()
getNumstates()-1
.public void setNumstates(int numstates)
numstates
- Number of statesjava.lang.IllegalArgumentException
- if numstatus is less than or equal to 0public int getNumstates()
public void setTextColor(int text_color)
setTextColor
in interface ITextfieldElement
text_color
- This is an AARRGGBB value - normally you will want to set the alpha portion fully opaquepublic int getTextColor()
public void setFontSize(float points)
points
- - DP or SP units.public void setFontStyle(int font_style)
font_style
- Any of nUIConstants.style_*
java.lang.IllegalArgumentException
- if font_style is not validpublic int getFontStyle()
nUIConstants.style_*