Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

javax.swing
Class JRadioButton  view JRadioButton download JRadioButton.java

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Container
          extended byjavax.swing.JComponent
              extended byjavax.swing.AbstractButton
                  extended byjavax.swing.JToggleButton
                      extended byjavax.swing.JRadioButton
All Implemented Interfaces:
javax.accessibility.Accessible, java.awt.image.ImageObserver, java.awt.ItemSelectable, java.awt.MenuContainer, java.io.Serializable, SwingConstants

public class JRadioButton
extends JToggleButton

The JRadioButton component provides a visually selectable button with mutually exclusive behaviour within a ButtonGroup. A series of radio buttons can be used to provide options to the user, where the user can only select one of the available options. The state of the button is provided by the superclass, JToggleButton. JRadioButton adds the additional behaviour, that if two or more radio buttons are grouped together, the selection of one implies the deselection of the other buttons within the group.

Buttons are grouped by adding each instance to a ButtonGroup. The existence of such a grouping is not reflected visually, so other means should be used to denote this. For instance, the grouped buttons can be placed within the same panel, possibly with an appropriate border to denote the connection between the components.

Since:
1.2

Nested Class Summary
protected  class JRadioButton.AccessibleJRadioButton
          This class provides accessibility support for the toggle button.
 
Nested classes inherited from class javax.swing.JToggleButton
JToggleButton.AccessibleJToggleButton, JToggleButton.ToggleButtonModel
 
Nested classes inherited from class javax.swing.AbstractButton
AbstractButton.AccessibleAbstractButton, AbstractButton.ButtonChangeListener
 
Nested classes inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
 
Nested classes inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
private static long serialVersionUID
          Compatible with Sun's JDK.
 
Fields inherited from class javax.swing.AbstractButton
action, actionListener, actionPropertyChangeListener, BORDER_PAINTED_CHANGED_PROPERTY, borderPainted, changeEvent, changeListener, CONTENT_AREA_FILLED_CHANGED_PROPERTY, contentAreaFilled, current_icon, default_icon, disabeldIcon, DISABLED_ICON_CHANGED_PROPERTY, DISABLED_SELECTED_ICON_CHANGED_PROPERTY, disabledSelectedIcon, FOCUS_PAINTED_CHANGED_PROPERTY, focusPainted, HORIZONTAL_ALIGNMENT_CHANGED_PROPERTY, HORIZONTAL_TEXT_POSITION_CHANGED_PROPERTY, horizontalAlignment, horizontalTextPosition, ICON_CHANGED_PROPERTY, iconTextGap, itemListener, margin, MARGIN_CHANGED_PROPERTY, MNEMONIC_CHANGED_PROPERTY, mnemonicIndex, model, MODEL_CHANGED_PROPERTY, multiClickThreshhold, pressed_icon, PRESSED_ICON_CHANGED_PROPERTY, ROLLOVER_ENABLED_CHANGED_PROPERTY, ROLLOVER_ICON_CHANGED_PROPERTY, ROLLOVER_SELECTED_ICON_CHANGED_PROPERTY, rollOverEnabled, rolloverIcon, rolloverSelectedIcon, SELECTED_ICON_CHANGED_PROPERTY, selectedIcon, text, TEXT_CHANGED_PROPERTY, VERTICAL_ALIGNMENT_CHANGED_PROPERTY, VERTICAL_TEXT_POSITION_CHANGED_PROPERTY, verticalAlignment, verticalTextPosition
 
Fields inherited from class javax.swing.JComponent
accessibleContext, alignmentX, alignmentY, autoscrolls, border, debugGraphicsOptions, doubleBuffered, isCompletelyDirty, isPaintingDoubleBuffered, listenerList, maximumSize, minimumSize, opaque, preferredSize, requestFocusEnabled, TOOL_TIP_TEXT_KEY, toolTipText, 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 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
JRadioButton()
          Constructs an unselected radio button with no text or icon.
JRadioButton(Action a)
          Constructs a radio button using the labelling, state and icon specified by the supplied action.
JRadioButton(Icon icon)
          Constructs an unselected radio button with the supplied icon and no text.
JRadioButton(Icon icon, boolean selected)
          Constructs a radio button with the supplied icon and state.
JRadioButton(java.lang.String text)
          Constructs an unselected radio button using the supplied text and no icon.
JRadioButton(java.lang.String text, boolean selected)
          Constructs a radio button with the supplied text and state.
JRadioButton(java.lang.String text, Icon icon)
          Constructs an unselected radio button with the supplied text and icon.
JRadioButton(java.lang.String text, Icon icon, boolean selected)
          Constructs a radio button with the supplied text, icon and state.
 
Method Summary
 javax.accessibility.AccessibleContext getAccessibleContext()
          Returns the accessible context for this JRadioButton, in the form of an instance of AccessibleJRadioButton.
 java.lang.String getUIClassID()
          Returns a string specifying the name of the Look and Feel UI class that renders this component.
protected  java.lang.String paramString()
          Returns a string representation of this component for debugging use.
 void updateUI()
          This method resets the radio button's UI delegate to the default UI for the current look and feel.
 
Methods inherited from class javax.swing.AbstractButton
addActionListener, addChangeListener, addImpl, addItemListener, checkHorizontalKey, checkVerticalKey, configurePropertiesFromAction, createActionListener, createActionPropertyChangeListener, createChangeListener, createItemListener, doClick, doClick, fireActionPerformed, fireItemStateChanged, fireStateChanged, getAction, getActionCommand, getActionListeners, getChangeListeners, getDisabledIcon, getDisabledSelectedIcon, getDisplayedMnemonicIndex, getHorizontalAlignment, getHorizontalTextPosition, getIcon, getIconTextGap, getItemListeners, getLabel, getMargin, getMnemonic, getModel, getMultiClickThreshhold, getPressedIcon, getRolloverIcon, getRolloverSelectedIcon, getSelectedIcon, getSelectedObjects, getText, getUI, getVerticalAlignment, getVerticalTextPosition, imageUpdate, init, isBorderPainted, isContentAreaFilled, isFocusPainted, isRolloverEnabled, isSelected, paintBorder, removeActionListener, removeChangeListener, removeItemListener, setAction, setActionCommand, setBorderPainted, setContentAreaFilled, setDisabledIcon, setDisabledSelectedIcon, setDisplayedMnemonicIndex, setEnabled, setFocusPainted, setHorizontalAlignment, setHorizontalTextPosition, setIcon, setIconTextGap, setLabel, setLayout, setMargin, setMnemonic, setMnemonic, setModel, setMultiClickThreshhold, setPressedIcon, setRolloverEnabled, setRolloverIcon, setRolloverSelectedIcon, setSelected, setSelectedIcon, setText, setUI, setUIProperty, setVerticalAlignment, setVerticalTextPosition
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, fireAncestorEvent, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintChildren, paintComponent, paintImmediately, paintImmediately, paintImmediately2, paintSimple, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setFont, setForeground, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update, updateComponentInputMap
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, transferFocusDownCycle, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

serialVersionUID

private static final long serialVersionUID
Compatible with Sun's JDK.

See Also:
Constant Field Values
Constructor Detail

JRadioButton

public JRadioButton()
Constructs an unselected radio button with no text or icon.


JRadioButton

public JRadioButton(Action a)
Constructs a radio button using the labelling, state and icon specified by the supplied action.


JRadioButton

public JRadioButton(Icon icon)
Constructs an unselected radio button with the supplied icon and no text.


JRadioButton

public JRadioButton(Icon icon,
                    boolean selected)
Constructs a radio button with the supplied icon and state.


JRadioButton

public JRadioButton(java.lang.String text)
Constructs an unselected radio button using the supplied text and no icon.


JRadioButton

public JRadioButton(java.lang.String text,
                    boolean selected)
Constructs a radio button with the supplied text and state.


JRadioButton

public JRadioButton(java.lang.String text,
                    Icon icon)
Constructs an unselected radio button with the supplied text and icon.


JRadioButton

public JRadioButton(java.lang.String text,
                    Icon icon,
                    boolean selected)
Constructs a radio button with the supplied text, icon and state.

Method Detail

getAccessibleContext

public javax.accessibility.AccessibleContext getAccessibleContext()
Returns the accessible context for this JRadioButton, in the form of an instance of AccessibleJRadioButton. The context is created, if necessary.

Specified by:
getAccessibleContext in interface javax.accessibility.Accessible
Overrides:
getAccessibleContext in class JToggleButton

getUIClassID

public java.lang.String getUIClassID()
Returns a string specifying the name of the Look and Feel UI class that renders this component.

Overrides:
getUIClassID in class JToggleButton

paramString

protected java.lang.String paramString()
Returns a string representation of this component for debugging use. Users should not depend on anything as regards the content or formatting of this string, except for the fact that the returned string may never be null (only empty).

Overrides:
paramString in class JToggleButton

updateUI

public void updateUI()
This method resets the radio button's UI delegate to the default UI for the current look and feel.

Overrides:
updateUI in class JToggleButton