waba.ui
Class RadioGroup

java.lang.Object
  |
  +--waba.ui.RadioGroup

public class RadioGroup
extends java.lang.Object

RadioGroup is a Radio control grouper. It handles the click on a radio, unchecking the last selected one.

Use it as:

 RadioGroup rg = new RadioGroup();
 Radio r1 = new Radio("radio 1",rg);
 Radio r2 = new Radio("radio 2",rg);
 Radio r3 = new Radio("radio 3",rg);
 rg.clicked(r1); // activate r1 only
 
Note: there is no need (and you can't) add a RadioGroup to a container, since a RadioGroup is a class that doesn't extend Control.


Constructor Summary
RadioGroup()
           
 
Method Summary
 void add(Radio newMember)
           
 void clicked(Radio who)
          Called by the Radio when a click was made
 int getSelectedIndex()
          Returns the currently selected index (in the order that the Radios were added to the container), or -1 if none.
protected  void radioChecked(Radio who, boolean checked)
           
 void remove(Radio oldMember)
           
 void setSelectedIndex(int i)
          Selects the given radio and deselects the other one.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RadioGroup

public RadioGroup()
Method Detail

add

public void add(Radio newMember)

remove

public void remove(Radio oldMember)

clicked

public void clicked(Radio who)
Called by the Radio when a click was made

radioChecked

protected void radioChecked(Radio who,
                            boolean checked)

getSelectedIndex

public int getSelectedIndex()
Returns the currently selected index (in the order that the Radios were added to the container), or -1 if none. Note: this property is read-only.
Since:
SuperWaba 4.02

setSelectedIndex

public void setSelectedIndex(int i)
Selects the given radio and deselects the other one.
Parameters:
i - the zero-based index of the radio to be set (must be >= 0!).