Class RadioButtonFileSelector

All Implemented Interfaces:
ActionListener, ImageObserver, ItemSelectable, MenuContainer, Serializable, EventListener, Accessible, ScrollPaneConstants

public class RadioButtonFileSelector extends JScrollPane implements ActionListener, ItemSelectable
A ScrollPane that presents a list of file names as a series of JRadioButtons. When a button is selected, an ItemEvent.SELECTED event is thrown. The default layout is 4 columns, but this can be changed in the constructor or by using the setColumns method.
See Also:
  • Constructor Details

    • RadioButtonFileSelector

      public RadioButtonFileSelector(String title)
      Construct an empty RadioButtonFileSelector with the specified Border title and the default number of columns
      Parameters:
      title - selector title
    • RadioButtonFileSelector

      public RadioButtonFileSelector(String title, int columns)
      Construct an empty RadioButtonFileSelector with the specified Border title and the specified number of columns
      Parameters:
      title - selector title
      columns - number of columns per row.
    • RadioButtonFileSelector

      public RadioButtonFileSelector(String[] buttonNames)
      Construct a new RadioButtonFileSelector from a list of names of buttons with the specified title and default number of columns.
      Parameters:
      buttonNames - list of the names of the buttons
    • RadioButtonFileSelector

      public RadioButtonFileSelector(String[] buttonNames, int columns)
      Construct a new RadioButtonFileSelector from a list of names of buttons with the specified title and the specified number of columns.
      Parameters:
      buttonNames - list of the names of the buttons
      columns - number of columns per row.
    • RadioButtonFileSelector

      public RadioButtonFileSelector(String title, String[] buttonNames)
      Construct a new RadioButtonFileSelector from a list of names of buttons with the specified title and default number of rows.
      Parameters:
      title - title for the border around the panel
      buttonNames - list of the names of the buttons
    • RadioButtonFileSelector

      public RadioButtonFileSelector(String title, String[] buttonNames, int columns)
      Construct a new RadioButtonFileSelector from a list of names of buttons with the specified title and set the number of columns of buttons per row.
      Parameters:
      title - title for the border around the panel
      buttonNames - list of the names of the buttons
      columns - number of columns per row.
  • Method Details

    • setTitle

      public void setTitle(String title)
      Set the border title
      Parameters:
      title - title to put on the border. Titles are left justified.
    • setButtonList

      public void setButtonList(String[] buttonNames)
      Set the list of buttons
      Parameters:
      buttonNames - list of button names
    • setColumns

      public void setColumns(int columns)
      Set the number of columns in this panel
      Parameters:
      columns - number of columns of buttons
    • clearEntries

      public void clearEntries()
      Clear the entries in the panel
    • main

      public static void main(String[] args)
      Run "java ucar.unidata.ui.RadioButtonFileSelector" to test
      Parameters:
      args -
    • actionPerformed

      public void actionPerformed(ActionEvent e)
      ActionListener method
      Specified by:
      actionPerformed in interface ActionListener
      Parameters:
      e -
    • addItemListener

      public void addItemListener(ItemListener l)
      Adds the specified item listener to receive item events from this ojbect.
      Specified by:
      addItemListener in interface ItemSelectable
      Parameters:
      l -
    • removeItemListener

      public void removeItemListener(ItemListener l)
      Removes the specified item listener so that the item listener no longer receives item events from this object.
      Specified by:
      removeItemListener in interface ItemSelectable
      Parameters:
      l -
    • getSelectedObjects

      public Object[] getSelectedObjects()
      Returns an array (length 1) containing the selected radio button or null if no radio buttons are selected.
      Specified by:
      getSelectedObjects in interface ItemSelectable
      Returns:
      _more_
    • fireItemStateChanged

      protected void fireItemStateChanged(ItemEvent e)
      Notify ItemListeners when a radio button is selected
      Parameters:
      e -