Interfascia

Class Listing

IFTextField
IFRadioController
IFRadioButton
IFProgressBar
IFLookAndFeel
IFLabel
IFCheckBox
IFButton
GUIEvent
actionPerformed
GUIController

Examples

Text Field
Temperature Converter
Radio Buttons
Custom Widget Color
Button

IFRadioController

The IFRadioController object keeps track of all IFRadioButton components in one group and makes sure only one is selected. Radio buttons can be added to a group either by passing them to the radio controller through the add() method, or by specifying a controller when creating a new radio button.

Method Summary

IFRadioController()
IFRadioController(String label)

  • label, the name of the radio button group.

add(IFRadioButton button)

  • Adds a radio button to the controller's list of buttons it manages.
  • button, the button to be added.

remove(IFRadioButton button)

  • Removes a radio button from the controller's list of buttons it controls.
  • button, the button to be removed.

getSelected()

  • Returns the currently selected `IFRadioButton` object. If none is selected, it returns `null`.

getSelectedIndex()

  • Returns the numerical index of the currently selected `IFRadioButton`. If none is selected, its value is `-1`.

deselectAll()

  • Deselects the currently selected radio button so no buttons are selected.

addActionListener(Object listener)

  • Adds an action listener object which receives `GUIEvent` notifications when the button is clicked or released. You must implement the [actionPerformed()](/documentation/actionperformed/) method in order to receive events from the button.
  • listener, the object that events are sent to. (Usually `this`.)

Example

import interfascia.*;

GUIController c;
IFRadioController rc;
IFRadioButton b1, b2, b3;

void setup() {
   c = new GUIController(this);
   rc = new IFRadioController("Selector");
   b1 = new IFRadioButton("One", 30, 20, rc);
   b2 = new IFRadioButton("Two", 30, 40, rc);
   b3 = new IFRadioButton("Three", 30, 60, rc);

   c.add(b1);
   c.add(b2);
   c.add(b3);
}