buoy.widget

Class BRadioButton


public class BRadioButton
extends Widget

A BRadioButton is a Widget for selecting between several options. It is normally used as part of a RadioButtonGroup. Each BRadioButton represents a single option. Clicking on it selects it, and deselects all other members of its RadioButtonGroup.

In addition to the event types generated by all Widgets, BRadioButtons generate the following event types:

Author:
Peter Eastman

Constructor Summary

BRadioButton(String text, boolean state, RadioButtonGroup group)
Create a new BRadioButton.
BRadioButton(RadioButtonGroup group)
Create a new BRadioButton with no label, which is initially deselected.

Method Summary

RadioButtonGroup
getGroup()
Get the RadioButtonGroup this button is part of.
Dimension
getMaximumSize()
Get the largest size at which this Widget can reasonably be drawn.
boolean
getState()
Get the selection state of this radio button.
String
getText()
Get the text which appears on this radio button.
void
setGroup(RadioButtonGroup newGroup)
Set the RadioButtonGroup this button is part of.
void
setState(boolean selected)
Set the selection state of this radio button.
void
setText(String text)
Set the text which appears on this radio button.

Methods inherited from class buoy.widget.Widget

addEventLink, dispatchEvent, getBackground, getBounds, getComponent, getCursor, getFont, getMaximumSize, getMinimumSize, getName, getParent, getPreferredSize, hasFocus, isEnabled, isFocusable, isVisible, repaint, requestFocus, setBackground, setCursor, setEnabled, setFocusable, setFont, setName, setVisible

Methods inherited from class buoy.event.EventSource

addEventLink, addEventLink, addEventLink, dispatchEvent, removeEventLink

Constructor Details

BRadioButton

public BRadioButton(String text,
                    boolean state,
                    RadioButtonGroup group)
Create a new BRadioButton.
Parameters:
text - the text to display on the BRadioButton
state - the initial selection state of the BRadioButton
group - the RadioButtonGroup this radio button is part of

BRadioButton

public BRadioButton(RadioButtonGroup group)
Create a new BRadioButton with no label, which is initially deselected.
Parameters:
group - the RadioButtonGroup this radio button is part of

Method Details

getGroup

public RadioButtonGroup getGroup()
Get the RadioButtonGroup this button is part of.

getMaximumSize

public Dimension getMaximumSize()
Get the largest size at which this Widget can reasonably be drawn. When a WidgetContainer lays out its contents, it will attempt never to make this Widget larger than its maximum size.
Overrides:
getMaximumSize in interface Widget

getState

public boolean getState()
Get the selection state of this radio button.

getText

public String getText()
Get the text which appears on this radio button.

setGroup

public void setGroup(RadioButtonGroup newGroup)
Set the RadioButtonGroup this button is part of.

setState

public void setState(boolean selected)
Set the selection state of this radio button. If you set the selection state to true, the state of every other member of its RadioButtonGroup will be set to false.

setText

public void setText(String text)
Set the text which appears on this radio button.

Written by Peter Eastman.