buoy.widget

Class BRadioButtonMenuItem

Implemented Interfaces:
MenuWidget

public class BRadioButtonMenuItem
extends BMenuItem

A BRadioButtonMenuItem is a menu item for selecting between several options. It is normally used as part of a RadioButtonGroup. Each BRadioButtonMenuItem represents a single option. Choosing it from the menu selects it, and deselects all other members of its RadioButtonGroup.

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

Author:
Peter Eastman

Constructor Summary

BRadioButtonMenuItem(String text, Icon image, boolean state, RadioButtonGroup group)
Create a new BRadioButtonMenuItem.
BRadioButtonMenuItem(String text, boolean state, RadioButtonGroup group)
Create a new BRadioButtonMenuItem.
BRadioButtonMenuItem(String text, Shortcut shortcut, Icon image, boolean state, RadioButtonGroup group)
Create a new BRadioButtonMenuItem.
BRadioButtonMenuItem(String text, Shortcut shortcut, boolean state, RadioButtonGroup group)
Create a new BRadioButtonMenuItem.
BRadioButtonMenuItem(RadioButtonGroup group)
Create a new BRadioButtonMenuItem with no label, which is initially deselected.

Method Summary

JRadioButtonMenuItem
getComponent()
RadioButtonGroup
getGroup()
Get the RadioButtonGroup this menu item is part of.
boolean
getState()
Get the selection state of this menu item.
void
setGroup(RadioButtonGroup newGroup)
Set the RadioButtonGroup this menu item is part of.
void
setState(boolean selected)
Set the selection state of this menu item.

Methods inherited from class buoy.widget.BMenuItem

getActionCommand, getComponent, getIcon, getMnemonic, getShortcut, getText, setActionCommand, setIcon, setMnemonic, setShortcut, setText

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

BRadioButtonMenuItem

public BRadioButtonMenuItem(String text,
                            Icon image,
                            boolean state,
                            RadioButtonGroup group)
Create a new BRadioButtonMenuItem.
Parameters:
text - the text to display on the BRadioButtonMenuItem
image - the image to display next to the menu item
state - the initial selection state of the BRadioButtonMenuItem
group - the RadioButtonGroup this menu item is part of

BRadioButtonMenuItem

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

BRadioButtonMenuItem

public BRadioButtonMenuItem(String text,
                            Shortcut shortcut,
                            Icon image,
                            boolean state,
                            RadioButtonGroup group)
Create a new BRadioButtonMenuItem.
Parameters:
text - the text to display on the BRadioButtonMenuItem
shortcut - a keyboard shortcut which will activate this menu item
image - the image to display next to the menu item
state - the initial selection state of the BRadioButtonMenuItem
group - the RadioButtonGroup this menu item is part of

BRadioButtonMenuItem

public BRadioButtonMenuItem(String text,
                            Shortcut shortcut,
                            boolean state,
                            RadioButtonGroup group)
Create a new BRadioButtonMenuItem.
Parameters:
text - the text to display on the BRadioButtonMenuItem
shortcut - a keyboard shortcut which will activate this menu item
state - the initial selection state of the BRadioButtonMenuItem
group - the RadioButtonGroup this menu item is part of

BRadioButtonMenuItem

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

Method Details

getComponent

public JRadioButtonMenuItem getComponent()
Overrides:
getComponent in interface BMenuItem

getGroup

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

getState

public boolean getState()
Get the selection state of this menu item.

setGroup

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

setState

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

Written by Peter Eastman.