waba.ui
Class Radio

java.lang.Object
  |
  +--waba.ui.Control
        |
        +--waba.ui.Radio

public class Radio
extends Control

Radio is a radio control.

Here is an example showing a radio being used:

 public class MyProgram extends MainWindow
 {
 Radio radioMale, radioFemale;

 public void onStart()
 {
  RadioGroup rg = new RadioGroup();
  add(radioMale = new Radio("Male", rg), LEFT, AFTER);
  add(radioFemale = new Radio("Female", rg), AFTER+2, SAME);
  rg.clicked(radioMale); // activate the specified one.
 }

 public void onEvent(Event event)
 {
  if (event.type == ControlEvent.PRESSED &&
      event.target == radioMale)
   {
   ... handle radio Male being pressed
 
Radios can be grouped together in a RadioGroup. See the RadioGroup class for more details.


Fields inherited from class waba.ui.Control
AFTER, appId, asContainer, asWindow, backColor, backDis, BEFORE, BOTTOM, CENTER, enabled, FILL, FIT, fm, fmH, focusLess, font, foreColor, foreDis, height, LEFT, parent, PREFERRED, RANGE, RIGHT, SAME, TOP, visible, width, x, x2, y, y2
 
Constructor Summary
Radio(String text)
          Creates a radio control displaying the given text.
Radio(String text, RadioGroup radioGroup)
          Creates a radio control with the given text attached to the given RadioGroup
 
Method Summary
 boolean getChecked()
          Returns the checked state of the control.
 int getPreferredHeight()
          returns the preffered height of this control. added by guich
 int getPreferredWidth()
          returns the preffered width of this control. added by guich
 RadioGroup getRadioGroup()
          Returns the RadioGroup that this radio belongs to, or null if none.
 String getText()
          Gets the text displayed in the radio.
protected  void onColorsChanged(boolean colorsChanged)
          Called after a setEnabled, setForeColor and setBackColor and when a control has been added to a Container.
 void onEvent(Event event)
          Called by the system to pass events to the radio control.
protected  void onFontChanged()
          Called after a setFont
 void onPaint(Graphics g)
          Called by the system to draw the radio control.
 void setChecked(boolean checked)
          Sets the checked state of the control.
 void setText(String text)
          sets the text. added by guich
 
Methods inherited from class waba.ui.Control
addTimer, contains, createGraphics, getAbsoluteRect, getBackColor, getFont, getFontMetrics, getForeColor, getNext, getParent, getParentWindow, getPos, getRect, getSize, isDisplayed, isEnabled, isVisible, onBoundsChanged, onWindowPaintFinished, postEvent, removeTimer, repaint, repaintNow, requestFocus, setBackColor, setBackForeColors, setEnabled, setFocusLess, setFont, setForeColor, setRect, setRect, setRect, setVisible
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, toString, wait, wait
 

Constructor Detail

Radio

public Radio(String text)
Creates a radio control displaying the given text.

Radio

public Radio(String text,
             RadioGroup radioGroup)
Creates a radio control with the given text attached to the given RadioGroup
Method Detail

getRadioGroup

public RadioGroup getRadioGroup()
Returns the RadioGroup that this radio belongs to, or null if none.

setText

public void setText(String text)
sets the text. added by guich

getText

public String getText()
Gets the text displayed in the radio.

getChecked

public boolean getChecked()
Returns the checked state of the control.

setChecked

public void setChecked(boolean checked)
Sets the checked state of the control.

getPreferredWidth

public int getPreferredWidth()
returns the preffered width of this control. added by guich
Overrides:
getPreferredWidth in class Control

getPreferredHeight

public int getPreferredHeight()
returns the preffered height of this control. added by guich
Overrides:
getPreferredHeight in class Control

onEvent

public void onEvent(Event event)
Called by the system to pass events to the radio control.
Overrides:
onEvent in class Control
Tags copied from class: Control
Parameters:
event - the event to process
See Also:
Event, KeyEvent, PenEvent

onColorsChanged

protected void onColorsChanged(boolean colorsChanged)
Description copied from class: Control
Called after a setEnabled, setForeColor and setBackColor and when a control has been added to a Container. If colorsChanged is true, it was called from setForeColor/setBackColor/Container.add; otherwise, it was called from setEnabled
Overrides:
onColorsChanged in class Control

onFontChanged

protected void onFontChanged()
Description copied from class: Control
Called after a setFont
Overrides:
onFontChanged in class Control

onPaint

public void onPaint(Graphics g)
Called by the system to draw the radio control.
Overrides:
onPaint in class Control
Tags copied from class: Control
Parameters:
g - the graphics object for drawing
See Also:
Graphics