Java DTV API 1.3
18-Nov-2009

com.sun.dtv.lwuit
Class ButtonGroup

java.lang.Object
  extended by com.sun.dtv.lwuit.ButtonGroup

public class ButtonGroup
extends Object

This class is used to create a multiple-exclusion scope for a set of RadioButtons. Creating a set of RadioButtons with the same ButtonGroup object means that only one RadioButton can be selected among the ButtonGroup. Initially all RadioButtons are unselected.


Constructor Summary
ButtonGroup()
          Creates a new instance of ButtonsGroup.
 
Method Summary
 void add(RadioButton rb)
          Adds a RadioButton to the group.
 void clearSelection()
          Clears the selection such that none of the buttons in the ButtonGroup are selected.
 int getButtonCount()
          Returns the number of buttons in the group.
 RadioButton getRadioButton(int index)
          Returns the radio button at the given group index.
 int getSelectedIndex()
          Return the index of the selected button within the group.
 boolean isSelected()
          Returns whether a radio button in the group is selected.
 void remove(RadioButton rb)
          Removes a RadioButton from the group.
 void setSelected(int index)
          Sets the selected Radio button by index.
 void setSelected(RadioButton rb)
          Selects the given radio button.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ButtonGroup

public ButtonGroup()
Creates a new instance of ButtonsGroup.

Method Detail

add

public void add(RadioButton rb)
Adds a RadioButton to the group.

Parameters:
rb - a RadioButton to add

remove

public void remove(RadioButton rb)
Removes a RadioButton from the group.

Parameters:
rb - a RadioButton to remove

clearSelection

public void clearSelection()
Clears the selection such that none of the buttons in the ButtonGroup are selected.


getButtonCount

public int getButtonCount()
Returns the number of buttons in the group.

Returns:
number of radio buttons in the group

isSelected

public boolean isSelected()
Returns whether a radio button in the group is selected.

Returns:
true if a selection was made in the radio button group

getSelectedIndex

public int getSelectedIndex()
Return the index of the selected button within the group.

Returns:
the index of the selected button within the group

getRadioButton

public RadioButton getRadioButton(int index)
Returns the radio button at the given group index.

Parameters:
index - offset within the group starting with 0 and no larger than getButtonCount()
Returns:
the radio button instance

setSelected

public void setSelected(RadioButton rb)
Selects the given radio button.

Parameters:
rb - the radio button to set as selected

setSelected

public void setSelected(int index)
Sets the selected Radio button by index.

Parameters:
index - the index of the radio button to mark as selected

Java DTV API 1.3
18-Nov-2009

Copyright © 2008-2009 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, California 95054, U.S.A. All rights reserved.

U.S. Government Rights - Commercial software. Government users are subject to the Sun Microsystems, Inc. standard license agreement and applicable provisions of the FAR and its supplements. Sun, Sun Microsystems, the Sun logo and Java are trademarks or registered trademarks of Sun Microsystems, Inc. in the U.S. and other countries.Products covered by and information contained in this service manual are controlled by U.S. Export Control laws and may be subject to the export or import laws in other countries. Nuclear, missile, chemical biological weapons or nuclear maritime end uses or end users, whether direct or indirect, are strictly prohibited. Export or reexport to countries subject to U.S. embargo or to entities identified on U.S. export exclusion lists, including, but not limited to, the denied persons and specially designated nationals lists is strictly prohibited.

DOCUMENTATION IS PROVIDED AS IS AND ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE DISCLAIMED, EXCEPT TO THE EXTENT THAT SUCH DISCLAIMERS ARE HELD TO BE LEGALLY INVALID.

Use of this document is subject to license terms.