Class JLabeledRadioI18N

All Implemented Interfaces:
ActionListener, ImageObserver, MenuContainer, Serializable, EventListener, Accessible, JLabeledField

public class JLabeledRadioI18N extends JPanel implements JLabeledField, ActionListener
JLabeledRadioI18N creates a set of Radio buttons with a label. This is a version of the original JLabelledRadio class (now removed), but modified to accept resource names rather than language strings.
See Also:
  • Constructor Details

    • JLabeledRadioI18N

      public JLabeledRadioI18N(String labelResource, String[] itemResources, String selectedItem)
      Parameters:
      labelResource - text resource name for group label
      itemResources - list of resource names for individual buttons
      selectedItem - button to be selected (if not null)
    • JLabeledRadioI18N

      @Deprecated public JLabeledRadioI18N()
      Deprecated.
      - only for use in testing
  • Method Details

    • resetButtons

      public void resetButtons(String[] resources, String selected)
      Method is responsible for removing current JRadioButtons of ButtonGroup and add creating the JRadioButtons and adding them to the ButtonGroup. The resource name is used as the action command for the button model, and the resource value is used to set the button label.
      Parameters:
      resources - list of resource names
      selected - initially selected resource (if not null)
    • getText

      public String getText()
      The implementation will get the resource name from the selected radio button in the JButtonGroup.
      Specified by:
      getText in interface JLabeledField
    • setText

      public void setText(String resourceName)
      The implementation will iterate through the radio buttons and find the match. It then sets it to selected and sets all other radio buttons as not selected.
      Specified by:
      setText in interface JLabeledField
      Parameters:
      resourceName - name of resource whose button is to be selected
    • setLabel

      public final void setLabel(String labelResource)
      Set the group label from the resource name.
      Specified by:
      setLabel in interface JLabeledField
      Parameters:
      labelResource - The text to be looked up and set
    • addChangeListener

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

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

      public void actionPerformed(ActionEvent e)
      When a radio button is clicked, an ActionEvent is triggered.
      Specified by:
      actionPerformed in interface ActionListener