brf.j2me.dynaworks.ui
Class RadioButton

java.lang.Object
  |
  +--brf.j2me.dynaworks.ui.BasicWidget
        |
        +--brf.j2me.dynaworks.ui.RadioButton
All Implemented Interfaces:
UserWidget

public class RadioButton
extends BasicWidget

Custom user control widget for a radio button.

Radio buttons can be grouped in RadioGroups.

Version:
1.0
Author:
Bernd R. Fix
See Also:
UserWidget, BasicWidget, RadioGroup

Field Summary
private  RadioGroup group
          reference to group controler.
private  boolean selected
          state of the control.
private static Bitmap state0
          Bitmap "active"
private static Bitmap state1
          Bitmap "inactive"
private  java.lang.String text
          label of the control.
 
Fields inherited from class brf.j2me.dynaworks.ui.BasicWidget
g, h, w, x, y
 
Constructor Summary
RadioButton(java.lang.String label, int x, int y)
          constructor.
 
Method Summary
(package private) static void ()
           
 RadioGroup getGroup()
          get the radio button group reference.
 java.lang.String getText()
          get the radio button label.
 ActionEvent handlePenDown(int xc, int yc)
          Handle a "pen down" event.
 boolean isSelected()
          get the radio button state.
 void paint()
          Paint the user control.
 void setGroup(RadioGroup controler)
          set the radio button group reference.
 void setSelected(boolean mode)
          set the radio button state.
 void setText(java.lang.String s)
          set the radio button label.
 
Methods inherited from class brf.j2me.dynaworks.ui.BasicWidget
contains, handleKeyDown, handlePenMove, handlePenUp, handleSysKeyDown, hasFocus, loseFocus, setFocus
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

text

private java.lang.String text
label of the control.

selected

private boolean selected
state of the control.

group

private RadioGroup group
reference to group controler.

state0

private static Bitmap state0
Bitmap "active"

state1

private static Bitmap state1
Bitmap "inactive"
Constructor Detail

RadioButton

public RadioButton(java.lang.String label,
                   int x,
                   int y)
constructor.

Parameters:
label - String - a text for the radio button.
x - int - x coordinate of upper-left corner.
y - int - y coordinate of upper-left corner.
Method Detail

static void ()

isSelected

public boolean isSelected()
get the radio button state.

Returns:
boolean - radio button selected?.

setSelected

public void setSelected(boolean mode)
set the radio button state.

Parameters:
mode - boolean - new selection mode for radio button.

getText

public java.lang.String getText()
get the radio button label.

Returns:
String - radio button text.

setText

public void setText(java.lang.String s)
set the radio button label.

Parameters:
s - String - new radio button text.

getGroup

public RadioGroup getGroup()
get the radio button group reference.

Returns:
RadioGroup - radio button controler.
See Also:
RadioGroup

setGroup

public void setGroup(RadioGroup controler)
set the radio button group reference.

Parameters:
controler - RadioGroup - radio button controler.
See Also:
RadioGroup

handlePenDown

public ActionEvent handlePenDown(int xc,
                                 int yc)
Handle a "pen down" event. Return an ActionEvent if neccessary.

Overrides:
handlePenDown in class BasicWidget
Parameters:
xc - int - x coordinate of hit point.
yc - int - y coordinate of hit point.
Returns:
ActionEvent - event triggered by PenDown (or null).
See Also:
ActionEvent

paint

public void paint()
Paint the user control.

Overrides:
paint in class BasicWidget