JavaTM Platform
Standard Ed. 6

javax.swing
クラス JRadioButton

java.lang.Object
  上位を拡張 java.awt.Component
      上位を拡張 java.awt.Container
          上位を拡張 javax.swing.JComponent
              上位を拡張 javax.swing.AbstractButton
                  上位を拡張 javax.swing.JToggleButton
                      上位を拡張 javax.swing.JRadioButton
すべての実装されたインタフェース:
ImageObserver, ItemSelectable, MenuContainer, Serializable, Accessible, SwingConstants

public class JRadioButton
extends JToggleButton
implements Accessible

ラジオボタンの実装です。 ラジオボタンは、選択または選択解除が可能な項目で、その状態を表示します。ButtonGroup オブジェクトと組み合わせて使用すると、1 回に 1 つのボタンだけを選択できる、ボタンのグループを作成できます。ButtonGroup オブジェクトを作成し、その add メソッドで、JRadioButton オブジェクト (複数) をグループに組み込みます。

注: ButtonGroup オブジェクトは論理的なグループであり、物理的なグループではありません。ボタンのパネルを作成するには、JPanel あるいはそれと同様のコンテナオブジェクトを作成し、それに Border を追加して、周囲にあるコンポーネント (複数) から区切る必要があります。

ボタンは構成可能で、Action を使ってある程度まで制御できます。ボタンに対して Action を使用すると、直接ボタンを構成するよりも多くの利点があります。詳細は、Action をサポートする Swing コンポーネント」を参照してください。また、「The Java Tutorial」の「How to Use Actions」も参照してください。  

詳細は、「The Java Tutorial」の「How to Use Buttons, Check Boxes, and Radio Buttons」を参照してください。  

警告: Swing はスレッドに対して安全ではありません。詳細は、「Swing's Threading Policy」を参照してください。  

警告: このクラスの直列化されたオブジェクトは、今後の Swing リリースと互換ではなくなる予定です。現在の直列化のサポートは、短期間の運用や、同じバージョンの Swing を実行するアプリケーション間の RMI に適しています。JDK Version 1.4 以降、すべての JavaBeans の長期間の運用サポートは、java.beans パッケージに追加されています。詳細は、XMLEncoder を参照してください。

関連項目:
ButtonGroup, JCheckBox

入れ子のクラスの概要
protected  class JRadioButton.AccessibleJRadioButton
          このクラスは JRadioButton クラス用のアクセシビリティーサポートを実装しています。
 
クラス javax.swing.JToggleButton から継承された入れ子のクラス/インタフェース
JToggleButton.AccessibleJToggleButton, JToggleButton.ToggleButtonModel
 
クラス javax.swing.AbstractButton から継承された入れ子のクラス/インタフェース
AbstractButton.AccessibleAbstractButton, AbstractButton.ButtonChangeListener
 
クラス javax.swing.JComponent から継承された入れ子のクラス/インタフェース
JComponent.AccessibleJComponent
 
クラス java.awt.Container から継承された入れ子のクラス/インタフェース
Container.AccessibleAWTContainer
 
クラス java.awt.Component から継承された入れ子のクラス/インタフェース
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
フィールドの概要
 
クラス 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
 
クラス javax.swing.JComponent から継承されたフィールド
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
クラス java.awt.Component から継承されたフィールド
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
インタフェース 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
 
インタフェース java.awt.image.ImageObserver から継承されたフィールド
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
コンストラクタの概要
JRadioButton()
          初期状態では選択解除されているラジオボタンを、テキストの指定なしで作成します。
JRadioButton(Action a)
          指定された Action からプロパティーを取得するラジオボタンを作成します。
JRadioButton(Icon icon)
          初期状態では選択解除されているラジオボタンを、イメージの指定あり、テキストの指定なしで作成します。
JRadioButton(Icon icon, boolean selected)
          ラジオボタンを、選択状態とイメージの指定あり、テキストの指定なしで作成します。
JRadioButton(String text)
          選択解除状態のラジオボタンを、テキストの指定ありで作成します。
JRadioButton(String text, boolean selected)
          ラジオボタンを、選択状態とテキストの指定ありで作成します。
JRadioButton(String text, Icon icon)
          初期状態では選択解除のラジオボタンを、テキストとイメージの指定ありで作成します。
JRadioButton(String text, Icon icon, boolean selected)
          ラジオボタンを、テキスト、イメージ、および選択状態の指定ありで作成します。
 
メソッドの概要
 AccessibleContext getAccessibleContext()
          この JRaioButton に関連した AccessibleContext を返します。
 String getUIClassID()
          このコンポーネントを描画する L&F クラスの名前を返します。
protected  String paramString()
          この JRadioButton の文字列表現を返します。
 void updateUI()
          現在の Look & Feel からの値に UI プロパティーをリセットします。
 
クラス javax.swing.AbstractButton から継承されたメソッド
actionPropertyChanged, addActionListener, addChangeListener, addImpl, addItemListener, checkHorizontalKey, checkVerticalKey, configurePropertiesFromAction, createActionListener, createActionPropertyChangeListener, createChangeListener, createItemListener, doClick, doClick, fireActionPerformed, fireItemStateChanged, fireStateChanged, getAction, getActionCommand, getActionListeners, getChangeListeners, getDisabledIcon, getDisabledSelectedIcon, getDisplayedMnemonicIndex, getHideActionText, 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, removeNotify, setAction, setActionCommand, setBorderPainted, setContentAreaFilled, setDisabledIcon, setDisabledSelectedIcon, setDisplayedMnemonicIndex, setEnabled, setFocusPainted, setHideActionText, setHorizontalAlignment, setHorizontalTextPosition, setIcon, setIconTextGap, setLabel, setLayout, setMargin, setMnemonic, setMnemonic, setModel, setMultiClickThreshhold, setPressedIcon, setRolloverEnabled, setRolloverIcon, setRolloverSelectedIcon, setSelected, setSelectedIcon, setText, setUI, setVerticalAlignment, setVerticalTextPosition
 
クラス javax.swing.JComponent から継承されたメソッド
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
クラス java.awt.Container から継承されたメソッド
add, add, add, add, add, addContainerListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, transferFocusBackward, transferFocusDownCycle, validate, validateTree
 
クラス 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, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, 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, 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, transferFocusUpCycle
 
クラス java.lang.Object から継承されたメソッド
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

コンストラクタの詳細

JRadioButton

public JRadioButton()
初期状態では選択解除されているラジオボタンを、テキストの指定なしで作成します。


JRadioButton

public JRadioButton(Icon icon)
初期状態では選択解除されているラジオボタンを、イメージの指定あり、テキストの指定なしで作成します。

パラメータ:
icon - ボタンで表示するイメージ

JRadioButton

public JRadioButton(Action a)
指定された Action からプロパティーを取得するラジオボタンを作成します。

導入されたバージョン:
1.3

JRadioButton

public JRadioButton(Icon icon,
                    boolean selected)
ラジオボタンを、選択状態とイメージの指定あり、テキストの指定なしで作成します。

パラメータ:
icon - ボタンで表示するイメージ
selected - true の場合、初期状態でボタンが選択される。 そうでない場合、初期状態でボタンは選択されない

JRadioButton

public JRadioButton(String text)
選択解除状態のラジオボタンを、テキストの指定ありで作成します。

パラメータ:
text - ラジオボタンに表示する文字列

JRadioButton

public JRadioButton(String text,
                    boolean selected)
ラジオボタンを、選択状態とテキストの指定ありで作成します。

パラメータ:
text - ラジオボタンに表示する文字列
selected - true の場合、初期状態でボタンが選択される。 そうでない場合、初期状態でボタンは選択されない

JRadioButton

public JRadioButton(String text,
                    Icon icon)
初期状態では選択解除のラジオボタンを、テキストとイメージの指定ありで作成します。

パラメータ:
text - ラジオボタンに表示する文字列
icon - ボタンで表示するイメージ

JRadioButton

public JRadioButton(String text,
                    Icon icon,
                    boolean selected)
ラジオボタンを、テキスト、イメージ、および選択状態の指定ありで作成します。

パラメータ:
text - ラジオボタンに表示する文字列
icon - ボタンで表示するイメージ
メソッドの詳細

updateUI

public void updateUI()
現在の Look & Feel からの値に UI プロパティーをリセットします。

オーバーライド:
クラス JToggleButton 内の updateUI
関連項目:
JComponent.updateUI()

getUIClassID

public String getUIClassID()
このコンポーネントを描画する L&F クラスの名前を返します。

オーバーライド:
クラス JToggleButton 内の getUIClassID
戻り値:
文字列「RadioButtonUI」
関連項目:
JComponent.getUIClassID(), UIDefaults.getUI(javax.swing.JComponent)

paramString

protected String paramString()
この JRadioButton の文字列表現を返します。このメソッドはデバッグ専用であり、返される文字列の内容および形式は実装によって異なります。返される文字列は空の場合がありますが、null にはなりません。

オーバーライド:
クラス JToggleButton 内の paramString
戻り値:
この JRadioButton の文字列表現

getAccessibleContext

public AccessibleContext getAccessibleContext()
この JRaioButton に関連した AccessibleContext を返します。JRadioButton の場合、AccessibleContext は AccessibleJRadioButton の形式を取ります。必要に応じて新規の AccessibleJRadioButton インスタンスが作成されます。

定義:
インタフェース Accessible 内の getAccessibleContext
オーバーライド:
クラス JToggleButton 内の getAccessibleContext
戻り値:
この JRadioButton の AccessibleContext として 機能する AccessibleJRadioButton

JavaTM Platform
Standard Ed. 6

バグの報告と機能のリクエスト
さらに詳しい API リファレンスおよび開発者ドキュメントについては、Java SE 開発者用ドキュメントを参照してください。開発者向けの詳細な解説、概念の概要、用語の定義、バグの回避策、およびコード実例が含まれています。

Copyright 2006 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms. Documentation Redistribution Policy も参照してください。