org.pf.swing
Class RadioButtonGroup

java.lang.Object
  extended by javax.swing.ButtonGroup
      extended by org.pf.swing.RadioButtonGroup
All Implemented Interfaces:
java.io.Serializable

public class RadioButtonGroup
extends javax.swing.ButtonGroup

A radio button group with some additional convenience methods

Version:
1.0
Author:
Manfred Duchrow
See Also:
Serialized Form

Constructor Summary
RadioButtonGroup()
          Initialize the new instance with default values.
 
Method Summary
 void add(javax.swing.AbstractButton button)
           
 java.lang.Object getSelectedValue()
          Returns the value associated with the button currently selected.
 void selectByValue(java.lang.Object valueOfButton)
          Changes the selection to the radio button which has the same value as the given parameter.
 
Methods inherited from class javax.swing.ButtonGroup
getButtonCount, getElements, getSelection, isSelected, remove, setSelected
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RadioButtonGroup

public RadioButtonGroup()
Initialize the new instance with default values.

Method Detail

add

public void add(javax.swing.AbstractButton button)
Overrides:
add in class javax.swing.ButtonGroup
Throws:
java.lang.IllegalArgumentException - If the given button is not an instance of RadioButton
See Also:
Allows only RadioButton instances to be added

selectByValue

public void selectByValue(java.lang.Object valueOfButton)
Changes the selection to the radio button which has the same value as the given parameter.

Parameters:
valueOfButton - The value of the button to select
Throws:
java.lang.IllegalArgumentException - If the given value is null

getSelectedValue

public java.lang.Object getSelectedValue()
Returns the value associated with the button currently selected. If none is selected, null will be returned.