Package totalcross.ui
Class RadioGroupController
- java.lang.Object
-
- totalcross.ui.RadioGroupController
-
public class RadioGroupController extends java.lang.ObjectRadioGroupController is a Radio control grouper. It handles the click on a radio, unchecking the last selected one.Use it as:
RadioGroupController rg = new RadioGroupController(); Radio r1 = new Radio("radio 1",rg); Radio r2 = new Radio("radio 2",rg); Radio r3 = new Radio("radio 3",rg); rg.setSelectedItem(r1); // activate r1 onlyNote: there is no need (and you can't) add a RadioGroupController to a container, since a RadioGroupController is a class that doesn't extend Control.
-
-
Field Summary
Fields Modifier and Type Field Description booleansendPressOnLastSet to false to disable sending PRESSED events to the previous control.
-
Constructor Summary
Constructors Constructor Description RadioGroupController()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(Radio newMember)Adds a new Radio to the list of Radios this controller handles.RadiogetRadio(int idx)Returns the Radio at the given index.intgetSelectedIndex()Returns the currently selected index (in the order that the Radios were added to the container), or -1 if none.RadiogetSelectedItem()Returns the currently selected Radio, or null if none.intgetSize()Returns the number of Radio's.voidremove(Radio oldMember)Removes the given Radio from the list of Radios this controller handles.voidsetSelectedIndex(int i)Selects the given radio and deselects the other one.voidsetSelectedIndex(int i, boolean sendPressEvent)Selects the given radio and deselects the other one.voidsetSelectedItem(java.lang.String text)Selects a radio whose text matches the given captionvoidsetSelectedItem(Radio who)Called by the Radio when a click was madeprotected voidsetSelectedItem(Radio who, boolean checked)voidsetSelectedItemStartingWith(java.lang.String text, boolean caseInsensitive)Selects a radio whose text starts with the given caption
-
-
-
Method Detail
-
add
public void add(Radio newMember)
Adds a new Radio to the list of Radios this controller handles. This method is called by the Radio's constructor.
-
remove
public void remove(Radio oldMember)
Removes the given Radio from the list of Radios this controller handles. You must explicitly call this method, if needed.
-
setSelectedItem
public void setSelectedItem(Radio who)
Called by the Radio when a click was made
-
setSelectedItem
public void setSelectedItem(java.lang.String text)
Selects a radio whose text matches the given caption
-
setSelectedItemStartingWith
public void setSelectedItemStartingWith(java.lang.String text, boolean caseInsensitive)Selects a radio whose text starts with the given caption
-
setSelectedItem
protected void setSelectedItem(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.- Since:
- SuperWaba 4.02
-
getSelectedItem
public Radio getSelectedItem()
Returns the currently selected Radio, or null if none.- 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, or -1 to disable all.
-
setSelectedIndex
public void setSelectedIndex(int i, boolean sendPressEvent)Selects the given radio and deselects the other one.- Parameters:
i- the zero-based index of the radio to be set, or -1 to disable all.
-
getRadio
public Radio getRadio(int idx)
Returns the Radio at the given index.- Since:
- TotalCross 1.5
-
getSize
public int getSize()
Returns the number of Radio's.
-
-