Java プラットフォーム 1.2

javax.swing
クラス JRadioButton

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--javax.swing.JComponent
                    |
                    +--javax.swing.AbstractButton
                          |
                          +--javax.swing.JToggleButton
                                |
                                +--javax.swing.JRadioButton

public class JRadioButton
extends JToggleButton
implements Accessible

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

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

詳細なドキュメントについては、「The Java Tutorial」「How to Use Radio Buttons」を参照してください。

標準の Look & Feel (L&F) 表現でこのコンポーネントが使用するキーボードのキーについては、JRadioButton のキーの割り当てを参照してください。

警告: このクラスの直列化されたオブジェクトは、今後の Swing リリースと互換ではなくなる予定です。現在の直列化のサポートは、短期間の運用や、同じバージョンの Swing を実行するアプリケーション間の RMI に適しています。今後の Swing リリースでは、長期間の持続性をサポートする予定です。

関連項目:
ButtonGroup, JCheckBox, 直列化された形式

内部クラスの概要
protected  class JRadioButton.AccessibleJRadioButton
          オブジェクトのユーザ補助機能を取得するために使用するクラスです。
 
クラス javax.swing.JToggleButton から継承した内部クラス
JToggleButton.AccessibleJToggleButton, JToggleButton.ToggleButtonModel
 
クラス javax.swing.AbstractButton から継承した内部クラス
AbstractButton.AccessibleAbstractButton, AbstractButton.ButtonChangeListener
 
クラス javax.swing.JComponent から継承した内部クラス
JComponent.AccessibleJComponent
 
クラス 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
 
コンストラクタの概要
JRadioButton()
          初期状態では選択解除されているラジオボタンを、テキストの指定なしで作成します。
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()
          JComponent に関連付けられた AccessibleContext を取得します。
 String getUIClassID()
          コンポーネントを描画する L&F クラスの名前を返します。
protected  String paramString()
          この JRadioButton の文字列表現を返します。
 void updateUI()
          L&F が変更されたことを示す UIFactory からの通知です。
 
クラス 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
 
クラス javax.swing.JComponent から継承したメソッド
addAncestorListener, addNotify, 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, processComponentKeyEvent, processFocusEvent, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, 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
 
クラス 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, print, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setLayout, validate, validateTree
 
クラス java.awt.Component から継承したメソッド
action, add, addComponentListener, addFocusListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addPropertyChangeListener, 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, printAll, processComponentEvent, processInputMethodEvent, processMouseEvent, remove, removeComponentListener, removeFocusListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus
 
クラス 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(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()
L&F が変更されたことを示す UIFactory からの通知です。
オーバーライド:
クラス JToggleButton 内の updateUI
関連項目:
JComponent.updateUI()

getUIClassID

public String getUIClassID()
コンポーネントを描画する L&F クラスの名前を返します。
戻り値:
文字列 「RadioButtonUI」
オーバーライド:
クラス JToggleButton 内の getUIClassID
関連項目:
JComponent.getUIClassID(), UIDefaults.getUI(javax.swing.JComponent)

paramString

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

JFC コンポーネントの新しい側面についての情報を返すには、paramString() をオーバーライドします。

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

getAccessibleContext

public AccessibleContext getAccessibleContext()
JComponent に関連付けられた AccessibleContext を取得します。
定義:
インタフェース Accessible 内の getAccessibleContext
戻り値:
JComponent の AccessibleContext
オーバーライド:
クラス JToggleButton 内の getAccessibleContext

Java プラットフォーム 1.2

バグや機能要求の報告
新しい javadoc の表示についてのコメントやご提案
Java は、米国およびその他の国における米国 Sun Microsystems, Inc. の商標もしくは登録商標です。
Copyright 1993-1998 Sun Microsystems, Inc. 901 San Antonio Road,
Palo Alto, California, 94303, U.S.A. All Rights Reserved.