JavaTM 2 Platform
Std. Ed. v1.3

javax.swing
クラス JRadioButton

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--javax.swing.JComponent
                    |
                    +--javax.swing.AbstractButton
                          |
                          +--javax.swing.JToggleButton
                                |
                                +--javax.swing.JRadioButton
すべての実装インタフェース:
Accessible, ImageObserver, ItemSelectable, MenuContainer, Serializable, SwingConstants

public class JRadioButton
extends JToggleButton
implements Accessible

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

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

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

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

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

関連項目:
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
 
クラス 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, NORTH, NORTH_EAST, NORTH_WEST, 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)
          ラジオボタンを、テキスト、イメージ、および選択状態の指定ありで作成します。
 
メソッドの概要
protected  void configurePropertiesFromAction(Action a)
          Action インスタンスの値に従って ActionEvent ソースのプロパティを設定するファクトリメソッドです。
protected  PropertyChangeListener createActionPropertyChangeListener(Action a)
          ActionEvent ソースを Action インスタンスのプロパティの変更として更新するのに使う PropertyChangeListener を生成するファクトリメソッドです。
 AccessibleContext getAccessibleContext()
          この JRaioButton に関連した 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, getAction, getActionCommand, getDisabledIcon, getDisabledSelectedIcon, getHorizontalAlignment, getHorizontalTextPosition, getIcon, getLabel, getMargin, getMnemonic, getModel, getPressedIcon, getRolloverIcon, getRolloverSelectedIcon, getSelectedIcon, getSelectedObjects, getText, getUI, getVerticalAlignment, getVerticalTextPosition, imageUpdate, init, isBorderPainted, isContentAreaFilled, isFocusPainted, isFocusTraversable, isRolloverEnabled, isSelected, paintBorder, removeActionListener, removeChangeListener, removeItemListener, setAction, 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, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getVerifyInputWhenFocusTarget, getVisibleRect, getWidth, getX, getY, grabFocus, hasFocus, hide, isDoubleBuffered, isFocusCycleRoot, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processFocusEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDoubleBuffered, setFont, setForeground, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setUI, setVerifyInputWhenFocusTarget, 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, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setLayout, validate, validateTree
 
クラス java.awt.Component から継承したメソッド
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, getBackground, getBounds, getColorModel, getComponentOrientation, getCursor, getDropTarget, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getInputContext, getInputMethodRequests, getLocale, getLocation, getLocationOnScreen, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, 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, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, 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(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()
L&F が変更されたことを示す UIFactory からの通知です。
オーバーライド:
クラス JToggleButton 内の updateUI
関連項目:
JComponent.updateUI()

getUIClassID

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

configurePropertiesFromAction

protected void configurePropertiesFromAction(Action a)
Action インスタンスの値に従って ActionEvent ソースのプロパティを設定するファクトリメソッドです。設定されるプロパティはサブクラスによって異なります。デフォルトでは、設定されるプロパティは Text、Icon、Enabled、および ToolTipText です。
オーバーライド:
クラス AbstractButton 内の configurePropertiesFromAction
パラメータ:
a - プロパティの取得元 Action、または null
導入されたバージョン:
1.3
関連項目:
Action, AbstractButton.setAction(javax.swing.Action)

createActionPropertyChangeListener

protected PropertyChangeListener createActionPropertyChangeListener(Action a)
ActionEvent ソースを Action インスタンスのプロパティの変更として更新するのに使う PropertyChangeListener を生成するファクトリメソッドです。最新の状態で保持する必要のあるプロパティのセットがデフォルトプロパティ (Text、Icon、Enabled、ToolTipText) と異なる場合は、独自の PropertyChangeListener を提供するためにサブクラスがこのメソッドをオーバーライドします。 PropertyChangeListener は ActionEvent ソースへの強い参照を保持しないようにする必要があります。これは、ActionEvent ソース、および包含関係の階層のすべてのコンポーネントのガベージコレクションを妨害する可能性があるからです。
オーバーライド:
クラス AbstractButton 内の createActionPropertyChangeListener
導入されたバージョン:
1.3
関連項目:
Action, AbstractButton.setAction(javax.swing.Action)

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 2 Platform
Std. Ed. v1.3

バグや機能要求の報告
さらに詳しい API リファレンスおよび開発者ドキュメントについては、 Java 2 SDK SE Developer Documentation を参照してください。このドキュメントには、概念、用語の定義、回避策、 実用的なコード例など、開発者を対象にした詳細な解説が掲載されています。

Java、Java 2D、JDBC は、米国およびその他の国における米国 Sun Microsystems, Inc. の商標もしくは登録商標です。
Copyright 1993-2000 Sun Microsystems, Inc. 901 San Antonio Road,
Palo Alto, California, 94303, U.S.A. All Rights Reserved.