org.apache.jorphan.gui

Class JLabeledRadio

Implemented Interfaces:
ActionListener, JLabeledField

public class JLabeledRadio
extends JPanel
implements JLabeledField, ActionListener

JLabeledRadio will create a set of Radio buttons with a label.
See Also:
for a version that is better suited to multi-language use.

Constructor Summary

JLabeledRadio()
JLabeledRadio(String label, String[] items)
JLabeledRadio(String label, String[] items, String selectedItem)

Method Summary

void
actionPerformed(ActionEvent e)
When a radio button is clicked, an ActionEvent is triggered.
void
addChangeListener(ChangeListener pChangeListener)
List
getComponentList()
Method will return all the label and JRadioButtons.
String
getText()
The implementation will get the Text value from the selected radio button in the JButtonGroup.
void
setItems(String[] items)
setItems will set the radio button items.
void
setLabel(String pLabel)
void
setText(String text)
The implementation will iterate through the radio buttons and find the match.

Constructor Details

JLabeledRadio

public JLabeledRadio()

JLabeledRadio

public JLabeledRadio(String label,
                     String[] items)

JLabeledRadio

public JLabeledRadio(String label,
                     String[] items,
                     String selectedItem)

Method Details

actionPerformed

public void actionPerformed(ActionEvent e)
When a radio button is clicked, an ActionEvent is triggered.

addChangeListener

public void addChangeListener(ChangeListener pChangeListener)
Specified by:
addChangeListener in interface JLabeledField

getComponentList

public List getComponentList()
Method will return all the label and JRadioButtons. ButtonGroup is excluded from the list.
Specified by:
getComponentList in interface JLabeledField

getText

public String getText()
The implementation will get the Text value from the selected radio button in the JButtonGroup.
Specified by:
getText in interface JLabeledField

setItems

public void setItems(String[] items)
setItems will set the radio button items. The implementation first removes the old JRadioButton, then it creates new ones.
Parameters:
items -

setLabel

public void setLabel(String pLabel)
Specified by:
setLabel in interface JLabeledField

setText

public void setText(String text)
The implementation will iterate through the radio buttons and find the match. It then sets it to selected and sets all other radion buttons as not selected.
Specified by:
setText in interface JLabeledField

Copyright © 1998-2010 Apache Software Foundation. All Rights Reserved.