SilverStream
Application Server 3.5

com.sssw.rt.jform
Class AgcJRadioButton

java.lang.Object
 |
 +--java.awt.Component
       |
       +--java.awt.Container
             |
             +--javax.swing.JComponent
                   |
                   +--javax.swing.AbstractButton
                         |
                         +--javax.swing.JToggleButton
                               |
                               +--javax.swing.JRadioButton
                                     |
                                     +--com.sssw.rt.jform.AgcJRadioButton
All Implemented Interfaces:
Accessible, AgiHelpInfo, ImageObserver, ItemSelectable, MenuContainer, Serializable, SwingConstants

public class AgcJRadioButton
extends JRadioButton
implements AgiHelpInfo

A lightweight component that displays a radio button with a text label. A radio button control has a boolean value indicating whether it is selected. It also has an Object value that is stored in the database when the control is bound to a database column.

Several radio buttons are generally grouped together so that only one is selected at a time. The checked value for the selected button becomes the value of all the buttons in the group. When using data-binding, all the buttons in the group should be bound to a single database column. The checked value for the selected button is the value stored in the database.

In the Form Designer, you create a group by specifying the same group name (using the Group property) for each radio button control. You can use the Rectangle control to visually group radio button controls. You can call AgcJRadioButton.getButtonGroup() and AgcJRadioButton.setButtonGroup(String) to manage button grouping in code.

In the Form Designer, you can specify a value of any data type for each button. This is equivalent to calling setCheckedValue() for the control.

There are several methods for dealing with the button's state and values:

Properties:
Caption Expression, Caption Text, Control Type, Data Column, Data Value, Enabled, Font Name, Font Size, Font Style, Height, Help Page, Left, Name, Radio Button Group, Tool Tip, Top, Visible, Width
Events:
actionPerformed, focusGained, focusLost, keyPressed, keyReleased, keyTyped, mouseClicked, mouseDragged, mouseEntered, mouseExited, mouseMoved, mousePressed, mouseReleased, validationFailed, validationTest, valueChanged
See Also:
Serialized Form

Inner classes inherited from class javax.swing.JRadioButton
JRadioButton.AccessibleJRadioButton
 
Inner classes inherited from class javax.swing.JToggleButton
JToggleButton.AccessibleJToggleButton, JToggleButton.ToggleButtonModel
 
Inner classes inherited from class javax.swing.AbstractButton
AbstractButton.AccessibleAbstractButton, AbstractButton.ButtonChangeListener
 
Inner classes inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
 
Fields inherited from class javax.swing.AbstractButton
actionListener, BORDER_PAINTED_CHANGED_PROPERTY, changeEvent, changeListener, CONTENT_AREA_FILLED_CHANGED_PROPERTY, DISABLED_ICON_CHANGED_PROPERTY, DISABLED_SELECTED_ICON_CHANGED_PROPERTY, FOCUS_PAINTED_CHANGED_PROPERTY, HORIZONTAL_ALIGNMENT_CHANGED_PROPERTY, HORIZONTAL_TEXT_POSITION_CHANGED_PROPERTY, ICON_CHANGED_PROPERTY, itemListener, MARGIN_CHANGED_PROPERTY, MNEMONIC_CHANGED_PROPERTY, model, MODEL_CHANGED_PROPERTY, PRESSED_ICON_CHANGED_PROPERTY, ROLLOVER_ENABLED_CHANGED_PROPERTY, ROLLOVER_ICON_CHANGED_PROPERTY, ROLLOVER_SELECTED_ICON_CHANGED_PROPERTY, SELECTED_ICON_CHANGED_PROPERTY, TEXT_CHANGED_PROPERTY, VERTICAL_ALIGNMENT_CHANGED_PROPERTY, VERTICAL_TEXT_POSITION_CHANGED_PROPERTY
 
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.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Constructor Summary
AgcJRadioButton()
          Creates an initially unselected radio button with no text.
AgcJRadioButton(Icon icon)
          Creates an initially unselected radio button with the specified image but no text.
AgcJRadioButton(Icon icon, boolean selected)
          Creates a radio button with the specified image and selection state, but no text.
AgcJRadioButton(String text)
          Creates an unselected radio button with the specified text.
AgcJRadioButton(String text, boolean selected)
          Creates a radio button with the specified text and selection state.
AgcJRadioButton(String text, Icon icon)
          Creates a radio button that has the specified text and image, and that is initially unselected.
AgcJRadioButton(String text, Icon icon, boolean selected)
          Creates a radio button that has the specified text, image, and selection state.
 
Method Summary
 String getButtonGroup()
          Gets the name of the button group for the radio button.
 Object getCheckedValue()
          Gets the button's "checked value" - the value assigned to the button group when the current button is selected.
 boolean getState()
          Deprecated. use isSelected().
 Object getValue()
          Gets the user-specified Object that is the current value for the button group.
 void setButtonGroup(String buttongroup)
          Sets the name of the button group for the radio button.
 void setCheckedValue(Object value)
          Sets the radio button's "checked value" - the value assigned to the button group when the current button is selected.
 void setState(boolean state)
          Deprecated. use setSelected().
 void setValue(Object value)
          Selects one of the buttons in the button group, based on the value of Object.
 
Methods inherited from class javax.swing.JRadioButton
getAccessibleContext, getUIClassID, paramString, updateUI
 
Methods inherited from class javax.swing.AbstractButton
addActionListener, addChangeListener, addItemListener, checkHorizontalKey, checkVerticalKey, createActionListener, createChangeListener, createItemListener, doClick, doClick, fireActionPerformed, fireItemStateChanged, fireStateChanged, getActionCommand, getDisabledIcon, getDisabledSelectedIcon, getHorizontalAlignment, getHorizontalTextPosition, getIcon, getLabel, getMargin, getMnemonic, getModel, getPressedIcon, getRolloverIcon, getRolloverSelectedIcon, getSelectedIcon, getSelectedObjects, getText, getUI, getVerticalAlignment, getVerticalTextPosition, init, isBorderPainted, isContentAreaFilled, isFocusPainted, isRolloverEnabled, isSelected, paintBorder, removeActionListener, removeChangeListener, removeItemListener, setActionCommand, setBorderPainted, setContentAreaFilled, setDisabledIcon, setDisabledSelectedIcon, setEnabled, setFocusPainted, setHorizontalAlignment, setHorizontalTextPosition, setIcon, setLabel, setMargin, setMnemonic, setMnemonic, setModel, setPressedIcon, setRolloverEnabled, setRolloverIcon, setRolloverSelectedIcon, setSelected, setSelectedIcon, setText, setUI, setVerticalAlignment, setVerticalTextPosition
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getAlignmentX, getAlignmentY, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getGraphics, getHeight, getInsets, getInsets, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getVisibleRect, getWidth, getX, getY, grabFocus, hasFocus, isDoubleBuffered, isFocusCycleRoot, isFocusTraversable, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, processComponentKeyEvent, processFocusEvent, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDoubleBuffered, setFont, setForeground, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setUI, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getLayout, insets, invalidate, isAncestorOf, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setCursor, setLayout, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, getBackground, getBounds, getColorModel, getComponentOrientation, getCursor, getDropTarget, getFont, getFontMetrics, getForeground, getInputContext, getInputMethodRequests, getLocale, getLocation, getLocationOnScreen, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hide, imageUpdate, inside, isDisplayable, isEnabled, isLightweight, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processInputMethodEvent, processMouseEvent, remove, removeComponentListener, removeFocusListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setDropTarget, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods implemented from interface com.sssw.rt.form.AgiHelpInfo
getHelpInfo, setHelpInfo
 

Constructor Detail

AgcJRadioButton

public AgcJRadioButton()
Creates an initially unselected radio button with no text.

AgcJRadioButton

public AgcJRadioButton(Icon icon)
Creates an initially unselected radio button with the specified image but no text.
Parameters:
icon - the image displayed on the radio button

AgcJRadioButton

public AgcJRadioButton(Icon icon,
                       boolean selected)
Creates a radio button with the specified image and selection state, but no text.
Parameters:
icon - the image displayed on the radio button
selected - if true, the button is initially selected; otherwise, the button is initially unselected

AgcJRadioButton

public AgcJRadioButton(String text)
Creates an unselected radio button with the specified text.
Parameters:
text - the text label displayed on the radio button

AgcJRadioButton

public AgcJRadioButton(String text,
                       boolean selected)
Creates a radio button with the specified text and selection state.
Parameters:
text - the text label displayed on the radio button
selected - if true, the button is initially selected; otherwise, the button is initially unselected

AgcJRadioButton

public AgcJRadioButton(String text,
                       Icon icon)
Creates a radio button that has the specified text and image, and that is initially unselected.
Parameters:
text - the text label displayed on the radio button
icon - the image displayed on the radio button

AgcJRadioButton

public AgcJRadioButton(String text,
                       Icon icon,
                       boolean selected)
Creates a radio button that has the specified text, image, and selection state.
Parameters:
text - the text label displayed on the radio button
icon - the image displayed on the radio button
Method Detail

setCheckedValue

public void setCheckedValue(Object value)
Sets the radio button's "checked value" - the value assigned to the button group when the current button is selected.
Parameters:
value - an Object that becomes the group's value when the radio button is selected
Usage:
This method works only if the radio button uses the default data model. AgcJRadioButton uses the default data model when no other model has been set using the setModel() method.
See Also:
AgcJRadioButton.getCheckedValue(), AgcJRadioButton.getValue(), AgcJRadioButton.setValue(Object)

getCheckedValue

public Object getCheckedValue()
Gets the button's "checked value" - the value assigned to the button group when the current button is selected.
Returns:
an Object that is the group's value when the radio button is selected
Usage:
This method works only if the radio button uses the default data model. AgcJRadioButton uses the default data model when no other model has been set using the setModel() method.
See Also:
AgcJRadioButton.setCheckedValue(Object), AgcJRadioButton.getValue(), AgcJRadioButton.setValue(Object)

setValue

public void setValue(Object value)
Selects one of the buttons in the button group, based on the value of Object. The value you specify becomes the group's value. If the value matches the checked value for a button, then that radio button becomes selected. If the value doesn't match any button, then all the buttons are deselected.
Parameters:
value - an Object whose value is intended to match the checked value of a button in the button group
Usage:
This method works only if the radio button uses the default data model. AgcJRadioButton uses the default data model when no other model has been set using the setModel() method.
See Also:
AgcJRadioButton.getValue()

getValue

public Object getValue()
Gets the user-specified Object that is the current value for the button group. It is the checked value of the currently selected button.
Returns:
an Object that is the current value of the button group
Usage:
This method works only if the radio button uses the default data model. AgcJRadioButton uses the default data model when no other model has been set using the setModel() method.
See Also:
AgcJRadioButton.setValue(Object)

setState

public void setState(boolean state)
Deprecated. use setSelected().

Set the state of the button.
See Also:
AbstractButton.setSelected(boolean)

getState

public boolean getState()
Deprecated. use isSelected().

Get the state of the button.
See Also:
AbstractButton.isSelected()

getButtonGroup

public String getButtonGroup()
Gets the name of the button group for the radio button.
Returns:
a String that is the group name
See Also:
AgcJRadioButton.setButtonGroup(String)

setButtonGroup

public void setButtonGroup(String buttongroup)
Sets the name of the button group for the radio button.
Parameters:
buttongroup - a String that is the group name
Usage:
Changing the group name does not change the appearance of the buttons on the form. For the user to understand a change in grouping, you will also have to adjust the layout.
See Also:
AgcJRadioButton.getButtonGroup()

SilverStream
Application Server 3.5