Palm API
Beta 2

com.sun.kjava
Class RadioButton

java.lang.Object
  |
  +--com.sun.kjava.RadioButton

public class RadioButton
extends java.lang.Object

A two-state button meant as part of a group, only one of which can be "on" at one time.

See Also:
RadioGroup

Constructor Summary
RadioButton()
          Create a new RadioButton.
RadioButton(int x, int y, java.lang.String text)
          Create a new RadioButton.
 
Method Summary
 java.lang.String getText()
          Get the label of the button.
 void handlePenDown(int x, int y)
          The pen has gone down in the button.
 boolean isSelected()
          Is this RadioButton currently selected?
 void paint()
          Paint the RadioButton on the screen.
 boolean pressed(int x, int y)
          Did the user press inside the RadioButton?
 void setLocation(int x, int y)
          Set the position of the RadioButton.
 void setParent(RadioGroup rg)
          Set the parent RadioGroup of this button.
 void setState(boolean state)
          Set the state of the button.
 void setText(java.lang.String text)
          Set the label of the button.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RadioButton

public RadioButton()
Create a new RadioButton.

RadioButton

public RadioButton(int x,
                   int y,
                   java.lang.String text)
Create a new RadioButton.
Parameters:
x - the X coordinate of the RadioButton's position
y - the Y coordinate of the RadioButton's position
text - the label for the button
Method Detail

setLocation

public void setLocation(int x,
                        int y)
Set the position of the RadioButton.
Parameters:
x - the X coordinate of the RadioButton's position
y - the Y coordinate of the RadioButton's position

setText

public void setText(java.lang.String text)
Set the label of the button.
Parameters:
text - the new text of the label

getText

public java.lang.String getText()
Get the label of the button.
Returns:
the text of the label

paint

public void paint()
Paint the RadioButton on the screen.

handlePenDown

public void handlePenDown(int x,
                          int y)
The pen has gone down in the button. Handle making or removing the selection.
Parameters:
x - the X coordinate of the RadioButton's position
y - the Y coordinate of the RadioButton's position

pressed

public boolean pressed(int x,
                       int y)
Did the user press inside the RadioButton?
Parameters:
x - the X coordinate of the RadioButton's position
y - the Y coordinate of the RadioButton's position
Returns:
true if the coordinates are within the area, false otherwise.

setParent

public void setParent(RadioGroup rg)
Set the parent RadioGroup of this button.
Parameters:
rg - the parental RadioGroup

setState

public void setState(boolean state)
Set the state of the button.
Parameters:
state - the new state; true means "selected"

isSelected

public boolean isSelected()
Is this RadioButton currently selected?
Returns:
true if selected, false if not

Submit a bug or feature

The GUI classes provided with this release are NOT part of CLDC, and they will be removed in later releases of this software. Official GUI classes for Java 2 Micro Edition will be defined separately through the Java Community Process and included in J2ME profiles. Java is trademark or registered trademark of Sun Microsystems, Inc. in the US and other countries.
Copyright 1993-2000 Sun Microsystems, Inc.
901 San Antonio Road, Palo Alto, California, 94303, U.S.A.
All Rights Reserved.