IFRadioButton
The IFRadioButton
object creates a new radio button GUI component. Each radio button must
belong to an IFRadioController
, which manages the behavior of a group of radio buttons.
Method Summary
IFRadioButton(String label, int x, int y, IFRadioController controller)
label
, the text displayed on the button.x
, the X position of the radio button's upper left corner.y
, the Y position of the radio button's upper left corner.controller
, the radio button manager for this button's button group.
setLabel(String newLabel)
- Sets the name of the button. The button name is used when submitting the interface's current state to a web server.
newLabel
, the new name for the button.
getLabel()
- Returns the button's name as a String.
setWidth(int width)
- Sets the width of the button.
width
, the new width for the button.
getWidth()
- Returns the width in pixels of the button in integer form.
setHeight(int height)
- Sets the height of the button.
height
, the new height for the button.
getHeight()
- Returns the height in pixels of the button in integer form.
setSize(int width, int height)
- A convenience method to set both dimensions of the button.
width
, the new width for the button.height
, the new height for the button.
setX(int x)
- Sets the X position of the button relative to its GUIController.
x
, the new X position for the button.
getX()
- Returns the X position in pixels of the button relative to its GUIController.
setY(int y)
- Sets the Y position of the button relative to its GUIController.
y
, the new Y position for the button.
getY()
- Returns the Y position in pixels of the button relative to its GUIController.
setPosition(int x, int y)
- A convenience method to set both the X and Y position of the button.
X
, the new X position for the button.Y
, the new Y position for the button.
isSelected()
- Returns whether the radio button is selected. Returns `true` if the button is selected, and `false` otherwise.
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(rc);
}