|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
edu.neu.ccs.gui.RadioPanel
RadioPanel implements the base panel
for matching strings and radio buttons and maintaining the
mutual exclusiveness of button selection.
| Nested Class Summary |
| Nested classes inherited from class javax.swing.JPanel |
JPanel.AccessibleJPanel |
| Nested classes inherited from class javax.swing.JComponent |
JComponent.AccessibleJComponent |
| Nested classes inherited from class java.awt.Container |
Container.AccessibleAWTContainer |
| Nested classes inherited from class java.awt.Component |
Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy |
| Field Summary | |
static String |
BACKGROUND
Bound property name for the set background property. |
protected ButtonGroup |
buttonGroup
Button buttonGroup to enforce mutual exclusion for selections. |
protected ActionSequence |
commonactions
The common actions for all buttons. |
protected static int |
DEFAULT_SELECTION
Default initial selection for an options view. |
protected TableLayout |
defaultLayout
The default layout. |
protected String |
defaultViewState
The default view state. |
protected StringObjectMap |
labelButtonMap
The string-object map that contains pairs with a label and its associated radio button. |
protected QuickHashMap |
labelIndexMap
The hash map that contains pairs with a label and an index installed as Integer with the position of the
label in the view. |
protected QuickHashMap |
modelButtonMap
The hash map that contains pairs with a model and its button. |
static String |
OPTION_COUNT
Bound property name for the option count property. |
static String |
SELECTED_BUTTON
Bound property name for the selected index property. |
static String |
SELECTED_INDEX
Bound property name for the selected index property. |
static String |
SELECTED_LABEL
Bound property name for the selected index property. |
static String |
SET_LABEL_TEXT
Bound property name for the set label text property. |
| Fields inherited from class javax.swing.JPanel |
|
| Fields inherited from class javax.swing.JComponent |
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW |
| Fields inherited from class java.awt.Container |
|
| Fields inherited from class java.awt.Component |
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
| Fields inherited from interface edu.neu.ccs.gui.Displayable |
DEFAULT_VIEW_STATE, VIEW_STATE |
| Fields inherited from interface edu.neu.ccs.util.JPTConstants |
ABOVE, ALIGNMENT, BELOW, BOTTOM_LEFT, BOTTOM_RIGHT, DEFAULT, FONT, INPUT_PROPERTIES, MANDATORY, OPTIONAL, ORIENTATION, TOP_LEFT, TOP_RIGHT, VALUE |
| Fields inherited from interface javax.swing.SwingConstants |
BOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NEXT, NORTH, NORTH_EAST, NORTH_WEST, PREVIOUS, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL, WEST |
| Fields inherited from interface java.awt.image.ImageObserver |
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
| Constructor Summary | |
RadioPanel()
The default constructor. |
|
RadioPanel(LayoutManager layout)
Constructs a panel with the given layout manager. |
|
RadioPanel(String[] strings)
Constructs a panel containing radio buttons labeled with the given array of strings. |
|
RadioPanel(String[] strings,
ActionListener action)
Constructs a panel containing radio buttons labeled with the given array of strings; the given action listener becomes a listener for all buttons. |
|
RadioPanel(String[] strings,
ActionListener[] actions)
Constructs a panel containing radio buttons labeled with the given array of strings; the given action listeners become listeners for the corresponding buttons. |
|
RadioPanel(String[] strings,
ActionListener[] actions,
int selection)
Constructs a panel containing radio buttons labeled with the given array of strings; the given action listeners become listeners for the corresponding buttons. |
|
RadioPanel(String[] strings,
ActionListener[] actions,
int selection,
LayoutManager layout)
Constructs a panel containing radio buttons labeled with the given array of strings; the given action listeners become listeners for the corresponding buttons. |
|
RadioPanel(String[] strings,
ActionListener[] actions,
LayoutManager layout)
Constructs a panel containing radio buttons labeled with the given array of strings; the given action listeners become listeners for the corresponding buttons. |
|
RadioPanel(String[] strings,
ActionListener action,
int selection)
Constructs a panel containing radio buttons labeled with the given array of strings; the given action listener becomes a listener for all buttons; the given selection is the index of the button that is initially selected. |
|
RadioPanel(String[] strings,
ActionListener action,
int selection,
LayoutManager layout)
Constructs a panel containing radio buttons labeled with the given array of strings; the given action listener becomes a listener for all buttons; the given selection is the index of the button that is initially selected; the given layout manager is used to layout the buttons. |
|
RadioPanel(String[] strings,
ActionListener action,
LayoutManager layout)
Constructs a panel containing radio buttons labeled with the given array of strings; the given action listener becomes a listener for all buttons; the given layout manager is used to layout the buttons. |
|
RadioPanel(String[] strings,
int selection)
Constructs a panel containing radio buttons labeled with the given array of strings; the given selection is the index of the button that is initially selected. |
|
RadioPanel(String[] strings,
int selection,
LayoutManager layout)
Constructs a panel containing radio buttons labeled with the given array of strings; the given selection is the index of the button that is initially selected; the given layout manager is used to layout the buttons. |
|
RadioPanel(String[] strings,
LayoutManager layout)
Constructs a panel containing radio buttons labeled with the given array of strings; the given layout manager is used to layout the buttons. |
|
| Method Summary | |
void |
addActionListener(ActionListener listener)
Adds the given action listener to all buttons. |
void |
addActionListener(int index,
ActionListener listener)
Adds the given action listener to the button at the given index. |
void |
addActionListeners(ActionListener[] listeners)
Adds the given action listeners to the corresponding buttons. |
void |
addOption(String label)
Adds a button to the end of the view with the given label. |
void |
addOption(String label,
Action action)
Adds a button to the end of the view with the given label and the given action. |
void |
addOption(String label,
Action action,
boolean selected)
Adds a button to the end of the view with the given label, the given action, and the given selection state. |
void |
addOption(String label,
boolean selected)
Adds a button to the end of the view with the given label and the given selection state. |
void |
addOptions(String[] labels)
Add the options in succession to the end of the view. |
void |
addOptions(String[] labels,
Action action)
Add the options in succession to the end of the view with the same action for each option. |
void |
addOptions(String[] labels,
Action[] actions)
Add the options in succession to the end of the view with the each option paired with a corresponding action. |
protected ButtonModel |
getButtonModel(JRadioButton button)
Returns the ButtonModel of the radio button or
returns null if the button is null
or is not in the view. |
static Color |
getDefaultBackground()
Returns the default background for a JRadioButton. |
static Font |
getDefaultFont()
Returns the default font for a JRadioButton. |
String |
getDefaultViewState()
Returns the current default view state string. |
int |
getIndex(JRadioButton button)
Returns the index of the option with the given button or -1 if the button is not in the view. |
int |
getIndex(String label)
Returns the index of the option with the given label or -1 if the label is not in the view. |
String |
getLabel(int index)
Returns the label of the option at the given index or null if the index is out of bounds. |
String |
getLabel(JRadioButton button)
Returns the label of the given button or null if the button is null
or is not in the view. |
String |
getLabelText(int index)
Returns the label text for the button at the given index, or null if the given index is invalid. |
protected JRadioButton |
getOptionButton(ButtonModel model)
Returns the JRadioButton of the button model or
returns null if the model is null
or if the model does not correspond to a button in the view. |
JRadioButton |
getOptionButton(int index)
Returns the JRadioButton at the given index
or returns null if the index is out of bounds. |
JRadioButton |
getOptionButton(String label)
Returns the JRadioButton corresponding to the
given label
or returns null if the label is null
or if the label does not correspond to a button in the view. |
JRadioButton[] |
getOptionButtons()
Returns an array containing the radio buttons for this view. |
int |
getOptionCount()
Returns the number of options for this view. |
JRadioButton |
getSelectedButton()
Returns the currently selected button or null if there are no buttons. |
int |
getSelectedIndex()
Returns the index of the selected button, or -1 if there are no buttons. |
String |
getSelectedLabel()
Returns the label of the currently selected button or null if there are no buttons. |
String |
getViewState()
Returns the label associated with the currently selected button or null if the panel is empty. |
protected void |
initializeRadioPanel(String[] strings,
int selection,
LayoutManager layout)
Performs the common initialization code for this class. |
void |
refreshComponent()
Refreshes the component by repacking the parent window. |
void |
removeActionListener(ActionListener listener)
Removes the given action listener from all buttons. |
void |
removeActionListener(int index,
ActionListener listener)
Removes the given action listener from the button at the given index. |
void |
removeActionListeners(ActionListener[] listeners)
Removes the given action listeners from the corresponding buttons. |
void |
reset()
Sets the currently selected button to the one corresponding to the current default view state string. |
void |
setBackground(Color color)
Sets the background for this component and its buttons. |
void |
setDefaultViewState(String state)
Sets the string corresponding to the default button selection. |
void |
setEnabled(boolean isEnabled)
Enable or disable the panel and its individual radio buttons. |
void |
setFont(Font font)
Sets the font for this component. |
boolean |
setLabelText(int index,
String label)
Sets the label for the button at the given index to the given label. |
boolean |
setSelectedButton(JRadioButton button)
Selects the given button. |
boolean |
setSelectedIndex(int index)
Selects the button at the given index. |
boolean |
setSelectedLabel(String label)
Selects the button corresponding to the label. |
void |
setViewState(String state)
Sets the currently selected button to the button whose string is the given state. |
| Methods inherited from class javax.swing.JPanel |
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
public static final String OPTION_COUNT
public static final String SELECTED_INDEX
public static final String SELECTED_LABEL
public static final String SELECTED_BUTTON
public static final String SET_LABEL_TEXT
public static final String BACKGROUND
protected static final int DEFAULT_SELECTION
protected String defaultViewState
protected StringObjectMap labelButtonMap
protected QuickHashMap labelIndexMap
Integer with the position of the
label in the view.
protected QuickHashMap modelButtonMap
protected ButtonGroup buttonGroup
protected TableLayout defaultLayout
protected ActionSequence commonactions
| Constructor Detail |
public RadioPanel()
The default constructor.
Other constructors:
- RadioPanel(LayoutManager)
- RadioPanel(String[])
- RadioPanel(String[], LayoutManager)
- RadioPanel(String[], int)
- RadioPanel(String[], int, LayoutManager)
- RadioPanel(String[], ActionListener)
- RadioPanel(String[], ActionListener, LayoutManager)
- RadioPanel(String[], ActionListener, int)
- RadioPanel(String[], ActionListener, int, LayoutManager)
- RadioPanel(String[], ActionListener[])
- RadioPanel(String[], ActionListener[], LayoutManager)
- RadioPanel(String[], ActionListener[], int)
- RadioPanel(String[], ActionListener[], int, LayoutManager)
public RadioPanel(LayoutManager layout)
Constructs a panel with the given layout manager.
If the given layout manager is null, then a
TableLayout with WEST alignment
and VERTICAL orientation will be used.
layout - the layout manager for the panelRadioPanel()public RadioPanel(String[] strings)
Constructs a panel containing radio buttons labeled with the given array of strings.
The strings in the array of strings should be distinct as duplicate strings will be ignored.
If the strings array is null or of length
zero, the panel will be initialized with no buttons.
strings - the array of labels for the radio buttonsRadioPanel()
public RadioPanel(String[] strings,
LayoutManager layout)
Constructs a panel containing radio buttons labeled with the given array of strings; the given layout manager is used to layout the buttons.
The strings in the array of strings should be distinct as duplicate strings will be ignored.
If the strings array is null or of length
zero, the panel will be initialized with no buttons.
If the given layout manager is null, then a
TableLayout with WEST alignment
and VERTICAL orientation will be used.
strings - the array of labels for the radio buttonslayout - the layout manager for the panelRadioPanel()
public RadioPanel(String[] strings,
int selection)
Constructs a panel containing radio buttons labeled with the given array of strings; the given selection is the index of the button that is initially selected.
The strings in the array of strings should be distinct as duplicate strings will be ignored.
If the initial selection index is invalid and if there are buttons in the panel then the selection index will be set to 0.
If the strings array is null or of length
zero, the panel will be initialized with no buttons.
strings - the array of labels for the radio buttonsselection - the index of the button selected by defaultRadioPanel()
public RadioPanel(String[] strings,
int selection,
LayoutManager layout)
Constructs a panel containing radio buttons labeled with the given array of strings; the given selection is the index of the button that is initially selected; the given layout manager is used to layout the buttons.
The strings in the array of strings should be distinct as duplicate strings will be ignored.
If the initial selection index is invalid and if there are buttons in the panel then the selection index will be set to 0.
If the strings array is null or of length
zero, the panel will be initialized with no buttons.
If the given layout manager is null, then a
TableLayout with WEST alignment
and VERTICAL orientation will be used.
strings - the array of labels for the radio buttonsselection - the index of the button selected by defaultlayout - the layout manager for the panelRadioPanel()
public RadioPanel(String[] strings,
ActionListener action)
Constructs a panel containing radio buttons labeled with the given array of strings; the given action listener becomes a listener for all buttons.
The strings in the array of strings should be distinct as duplicate strings will be ignored.
If the strings array is null or of length
zero, the panel will be initialized with no buttons.
strings - the array of labels for the radio buttonsaction - the action listener that will listen for selectionRadioPanel()
public RadioPanel(String[] strings,
ActionListener action,
LayoutManager layout)
Constructs a panel containing radio buttons labeled with the given array of strings; the given action listener becomes a listener for all buttons; the given layout manager is used to layout the buttons.
The strings in the array of strings should be distinct as duplicate strings will be ignored.
If the strings array is null or of length
zero, the panel will be initialized with no buttons.
If the given layout manager is null, then a
TableLayout with WEST alignment
and VERTICAL orientation will be used.
strings - the array of labels for the radio buttonsaction - the action listener that will listen for selectionlayout - the layout manager for the panelRadioPanel()
public RadioPanel(String[] strings,
ActionListener action,
int selection)
Constructs a panel containing radio buttons labeled with the given array of strings; the given action listener becomes a listener for all buttons; the given selection is the index of the button that is initially selected.
The strings in the array of strings should be distinct as duplicate strings will be ignored.
If the initial selection index is invalid and if there are buttons in the panel then the selection index will be set to 0.
If the strings array is null or of length
zero, the panel will be initialized with no buttons.
strings - the array of labels for the radio buttonsaction - the action listener that will listen for selectionselection - the index of the button selected by defaultRadioPanel()
public RadioPanel(String[] strings,
ActionListener action,
int selection,
LayoutManager layout)
Constructs a panel containing radio buttons labeled with the given array of strings; the given action listener becomes a listener for all buttons; the given selection is the index of the button that is initially selected; the given layout manager is used to layout the buttons.
The strings in the array of strings should be distinct as duplicate strings will be ignored.
If the initial selection index is invalid and if there are buttons in the panel then the selection index will be set to 0.
If the strings array is null or of length
zero, the panel will be initialized with no buttons.
If the given layout manager is null, then a
TableLayout with WEST alignment
and VERTICAL orientation will be used.
strings - the array of labels for the radio buttonsaction - the action listener that will listen for selectionselection - the index of the button selected by defaultlayout - the layout manager for the panelRadioPanel()
public RadioPanel(String[] strings,
ActionListener[] actions)
Constructs a panel containing radio buttons labeled with the given array of strings; the given action listeners become listeners for the corresponding buttons.
The strings in the array of strings should be distinct as duplicate strings will be ignored.
If the strings array is null or of length
zero, the panel will be initialized with no buttons.
strings - the array of labels for the radio buttonsactions - the action listeners that will listen for selectionRadioPanel()
public RadioPanel(String[] strings,
ActionListener[] actions,
LayoutManager layout)
Constructs a panel containing radio buttons labeled with the given array of strings; the given action listeners become listeners for the corresponding buttons.
the given layout manager is used to layout the buttons.The strings in the array of strings should be distinct as duplicate strings will be ignored.
If the strings array is null or of length
zero, the panel will be initialized with no buttons.
If the given layout manager is null, then a
TableLayout with WEST alignment
and VERTICAL orientation will be used.
strings - the array of labels for the radio buttonsactions - the action listeners that will listen for selectionlayout - the layout manager for the panelRadioPanel()
public RadioPanel(String[] strings,
ActionListener[] actions,
int selection)
Constructs a panel containing radio buttons labeled with the given array of strings; the given action listeners become listeners for the corresponding buttons.
the given selection is the index of the button that is initially selected.The strings in the array of strings should be distinct as duplicate strings will be ignored.
If the initial selection index is invalid and if there are buttons in the panel then the selection index will be set to 0.
If the strings array is null or of length
zero, the panel will be initialized with no buttons.
strings - the array of labels for the radio buttonsactions - the action listeners that will listen for selectionselection - the index of the button selected by defaultRadioPanel()
public RadioPanel(String[] strings,
ActionListener[] actions,
int selection,
LayoutManager layout)
Constructs a panel containing radio buttons labeled with the given array of strings; the given action listeners become listeners for the corresponding buttons.
the given selection is the index of the button that is initially selected; the given layout manager is used to layout the buttons.The strings in the array of strings should be distinct as duplicate strings will be ignored.
If the initial selection index is invalid and if there are buttons in the panel then the selection index will be set to 0.
If the strings array is null or of length
zero, the panel will be initialized with no buttons.
If the given layout manager is null, then a
TableLayout with WEST alignment
and VERTICAL orientation will be used.
strings - the array of labels for the radio buttonsactions - the action listeners that will listen for selectionselection - the index of the button selected by defaultlayout - the layout manager for the panelRadioPanel()| Method Detail |
protected final void initializeRadioPanel(String[] strings,
int selection,
LayoutManager layout)
strings - the array of labels for the radio buttonsselection - the index of the button selected by defaultlayout - the layout manager for the panelpublic final int getIndex(String label)
getIndex(JRadioButton),
getLabel(int),
getLabel(JRadioButton),
getOptionButton(int),
getOptionButton(String),
getOptionButton(ButtonModel),
getButtonModel(JRadioButton)public final int getIndex(JRadioButton button)
getIndex(String),
getLabel(int),
getLabel(JRadioButton),
getOptionButton(int),
getOptionButton(String),
getOptionButton(ButtonModel),
getButtonModel(JRadioButton)public final String getLabel(int index)
null if the index is out of bounds.
getIndex(String),
getIndex(JRadioButton),
getLabel(JRadioButton),
getOptionButton(int),
getOptionButton(String),
getOptionButton(ButtonModel),
getButtonModel(JRadioButton)public final String getLabel(JRadioButton button)
null if the button is null
or is not in the view.
getIndex(String),
getIndex(JRadioButton),
getLabel(int),
getOptionButton(int),
getOptionButton(String),
getOptionButton(ButtonModel),
getButtonModel(JRadioButton)public final JRadioButton getOptionButton(int index)
JRadioButton at the given index
or returns null if the index is out of bounds.
index - the index of the desired buttongetIndex(String),
getIndex(JRadioButton),
getLabel(int),
getLabel(JRadioButton),
getOptionButton(String),
getOptionButton(ButtonModel),
getButtonModel(JRadioButton)public final JRadioButton getOptionButton(String label)
JRadioButton corresponding to the
given label
or returns null if the label is null
or if the label does not correspond to a button in the view.
label - the label of the desired buttongetIndex(String),
getIndex(JRadioButton),
getLabel(int),
getLabel(JRadioButton),
getOptionButton(int),
getOptionButton(ButtonModel),
getButtonModel(JRadioButton)protected final JRadioButton getOptionButton(ButtonModel model)
JRadioButton of the button model or
returns null if the model is null
or if the model does not correspond to a button in the view.
model - the button model of the desired buttongetIndex(String),
getIndex(JRadioButton),
getLabel(int),
getLabel(JRadioButton),
getOptionButton(int),
getOptionButton(String),
getButtonModel(JRadioButton)protected final ButtonModel getButtonModel(JRadioButton button)
ButtonModel of the radio button or
returns null if the button is null
or is not in the view.
button - the radio buttongetIndex(String),
getIndex(JRadioButton),
getLabel(int),
getLabel(JRadioButton),
getOptionButton(int),
getOptionButton(String),
getOptionButton(ButtonModel)public final boolean setSelectedIndex(int index)
Selects the button at the given index.
Does nothing if the index is out of bounds or is equal to the current selected index.
index - the index of the button to be selected
getSelectedIndex(),
setSelectedLabel(String),
getSelectedLabel(),
setSelectedButton(JRadioButton),
getSelectedButton()public final int getSelectedIndex()
setSelectedIndex(int),
setSelectedLabel(String),
getSelectedLabel(),
setSelectedButton(JRadioButton),
getSelectedButton()public final boolean setSelectedLabel(String label)
Selects the button corresponding to the label.
This method does not change the current selection if the label corresponds to the current selection or is not associated with a button.
label - the label of the option to be selected
setSelectedIndex(int),
getSelectedIndex(),
getSelectedLabel(),
setSelectedButton(JRadioButton),
getSelectedButton()public final String getSelectedLabel()
null if there are no buttons.
setSelectedIndex(int),
getSelectedIndex(),
setSelectedLabel(String),
setSelectedButton(JRadioButton),
getSelectedButton()public final boolean setSelectedButton(JRadioButton button)
Selects the given button.
This method does not change the current selection if the button is already the selected button or is not in the view.
button - the button to be selected
setSelectedIndex(int),
getSelectedIndex(),
setSelectedLabel(String),
getSelectedLabel(),
getSelectedButton()public final JRadioButton getSelectedButton()
null if there are no buttons.
setSelectedIndex(int),
getSelectedIndex(),
setSelectedLabel(String),
getSelectedLabel(),
setSelectedButton(JRadioButton)
public final boolean setLabelText(int index,
String label)
Sets the label for the button at the given index to the given label.
Does nothing if:
null.
index - the index of the buttonlabel - the new label for the button
getLabelText(int)public final String getLabelText(int index)
Returns the label text for the button at the given index,
or null if the given index is invalid.
Equivalent to getLabel(index) but retained
for compatibility with older code.
index - the index of the option
whose label is to be returnedsetLabelText(int, String)public final void addOption(String label)
Adds a button to the end of the view with the given label.
Refreshes the component.
label - the label for the buttonaddOption(String, Action),
addOption(String, boolean),
addOption(String, Action, boolean),
addOptions(String[]),
addOptions(String[], Action),
addOptions(String[], Action[])
public final void addOption(String label,
Action action)
Adds a button to the end of the view with the given label and the given action.
Refreshes the component.
label - the label for the buttonaction - the action to perform if the option is pressedaddOption(String),
addOption(String, boolean),
addOption(String, Action, boolean),
addOptions(String[]),
addOptions(String[], Action),
addOptions(String[], Action[])
public final void addOption(String label,
boolean selected)
Adds a button to the end of the view with the given label and the given selection state.
Refreshes the component.
label - the label for the buttonselected - whether or not the option should be selectedaddOption(String),
addOption(String, Action),
addOption(String, Action, boolean),
addOptions(String[]),
addOptions(String[], Action),
addOptions(String[], Action[])
public final void addOption(String label,
Action action,
boolean selected)
Adds a button to the end of the view with the given label, the given action, and the given selection state.
Refreshes the component.
label - the label for the buttonaction - the action to perform if the option is pressedselected - whether or not the option should be selectedaddOption(String),
addOption(String, Action),
addOption(String, boolean),
addOptions(String[]),
addOptions(String[], Action),
addOptions(String[], Action[])public final void addOptions(String[] labels)
Add the options in succession to the end of the view.
Refreshes the component.
labels - the label text for the various optionsaddOption(String),
addOption(String, Action),
addOption(String, boolean),
addOption(String, Action, boolean),
addOptions(String[], Action),
addOptions(String[], Action[])
public final void addOptions(String[] labels,
Action action)
Add the options in succession to the end of the view with the same action for each option.
Refreshes the component.
labels - the label text for the various optionsaction - the action to pair with each optionaddOption(String),
addOption(String, Action),
addOption(String, boolean),
addOption(String, Action, boolean),
addOptions(String[]),
addOptions(String[], Action[])
public final void addOptions(String[] labels,
Action[] actions)
Add the options in succession to the end of the view with the each option paired with a corresponding action.
Refreshes the component.
labels - the label text for the various optionsactions - the actions to pair with the optionsaddOption(String),
addOption(String, Action),
addOption(String, boolean),
addOption(String, Action, boolean),
addOptions(String[]),
addOptions(String[], Action)public final int getOptionCount()
public final JRadioButton[] getOptionButtons()
getOptionButton(int)public final void addActionListener(ActionListener listener)
Adds the given action listener to all buttons.
Does nothing if the action listener is null.
listener - the action listener to add to all buttons
public final void addActionListener(int index,
ActionListener listener)
Adds the given action listener to the button at the given index.
Does nothing if the index is out of bounds
or the action listener is null.
index - the index of the buttonlistener - the action listener to add to the buttonpublic final void addActionListeners(ActionListener[] listeners)
Adds the given action listeners to the corresponding buttons.
Does nothing if the action listeners array is null.
listeners - the action listeners to add to the corresponding buttonspublic final void removeActionListener(ActionListener listener)
Removes the given action listener from all buttons.
Does nothing if the action listener is null.
listener - the action to remove from all buttons
public final void removeActionListener(int index,
ActionListener listener)
Removes the given action listener from the button at the given index.
Does nothing if the index is out of bounds
or the action listener is null.
index - the index of the buttonlistener - the listener to remove from the buttonpublic final void removeActionListeners(ActionListener[] listeners)
Removes the given action listeners from the corresponding buttons.
Does nothing if the action listeners array is null.
listeners - the action listeners to remove from the corresponding buttonspublic void setFont(Font font)
Sets the font for this component.
If the given font is null then it is set to
getDefaultFont().
Calls the super setFont method and
then sets the font for each radio button.
Refreshes the component.
Fires property change FONT.
font - the font to set for this viewpublic static Font getDefaultFont()
public void setBackground(Color color)
Sets the background for this component and its buttons.
If the given color is null then sets the given
color to getDefaultBackground().
Calls the super setBackground method and
then sets the background for each radio button.
Fires property change BACKGROUND.
color - the background to set for this componentpublic static Color getDefaultBackground()
public void setViewState(String state)
Sets the currently selected button to the button whose string is the given state.
If the given state does not correspond to a button, then does nothing.
This method may be overridden in a derived class if the class does not consider the view state of the view to be equivalent to the button label of the selected button.
setViewState in interface Displayablestate - the string to select the buttongetViewState(),
Displayablepublic String getViewState()
Returns the label associated with the currently selected button
or null if the panel is empty.
This method may be overridden in a derived class if the class does not consider the view state of the view to be equivalent to the button label of the selected button.
getViewState in interface DisplayableStringsetViewState(String),
Displayablepublic void setDefaultViewState(String state)
Sets the string corresponding to the default button selection.
If the given string does not correspond to a button at the time
the method reset() is called, then reset()
will do nothing. In other words, the given state is not checked for
validity at the time this method is called but only when the default
view state is used to reset the view state.
This method may be overridden in a derived class if the class does not consider the view state of the view to be equivalent to the button label of the selected button.
setDefaultViewState in interface Displayablestate - the proposed default view statereset(),
Displayablepublic String getDefaultViewState()
This method may be overridden in a derived class if the class does not consider the view state of the view to be equivalent to the button label of the selected button.
getDefaultViewState in interface DisplayablesetDefaultViewState(String),
reset()public final void reset()
Sets the currently selected button to the one corresponding to the current default view state string.
If the current default view state string does not currently correspond to a button, then does nothing.
Equivalent to setViewState(getDefaultViewState()).
reset in interface DisplayablesetDefaultViewState(String),
Displayablepublic final void setEnabled(boolean isEnabled)
setEnabled in interface DisplayableisEnabled - whether to enable or disablepublic void refreshComponent()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||