java.lang.Object | +--com.sun.kjava.Button
Button: a simple button user interface object. Note that this button causes actions to occur when it it pressed, not when it is released. Therefore it is currently impossible for a user to cancel a button selection once it has started! Bitmap buttons do not have a border drawn around them. If you want your bitmap button to have a border, include the border in the bitmap.
Field Summary | |
static int |
minWidth
|
Constructor Summary | |
Button(Bitmap bitmap,
int x,
int y)
Create a new Button object with graphical label. |
|
Button(java.lang.String s,
int x,
int y)
Create a new Button object with a text label. |
Method Summary | |
boolean |
isEnabled()
Is the Button enabled? |
void |
paint()
Paint the Button on the global Graphics context. |
boolean |
pressed(int x,
int y)
Was the button pressed? If the coordinates are within the Button, give the user some feedback. |
void |
setEnabled(boolean state)
Set whether the Button allows input (is "enabled"). |
void |
setText(java.lang.String s)
Set the Button's text label. |
Methods inherited from class java.lang.Object |
equals,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Field Detail |
public static final int minWidth
Constructor Detail |
public Button(java.lang.String s, int x, int y)
s
- the button's text labelx
- the x coordinate of the button's locationy
- the y coordinate of the button's locationpublic Button(Bitmap bitmap, int x, int y)
s
- the button's text labelx
- the x coordinate of the button's locationy
- the y coordinate of the button's locationMethod Detail |
public void setText(java.lang.String s)
s
- the new label for the button.public void setEnabled(boolean state)
state
- if true, Button allows input.public boolean isEnabled()
public void paint()
public boolean pressed(int x, int y)