public class RadioButton extends Button
Button
that maintains a selection state exclusively
within a specific ButtonGroup
STATE_DEFAULT, STATE_PRESSED, STATE_ROLLOVER
BOTTOM, BRB_CENTER_OFFSET, BRB_CONSTANT_ASCENT, BRB_CONSTANT_DESCENT, BRB_OTHER, CENTER, LEFT, RIGHT, TOP
Constructor and Description |
---|
RadioButton()
Creates an empty radio button
|
RadioButton(Image icon)
Constructs a radio with the given icon
|
RadioButton(String text)
Constructs a radio with the given text
|
RadioButton(String text,
Image icon)
Constructs a radio with the given text and icon
|
Modifier and Type | Method and Description |
---|---|
protected Dimension |
calcPreferredSize()
Calculates the preferred size based on component content.
|
boolean |
isSelected()
Returns true if the radio button is selected
|
void |
paint(Graphics g)
This method paints the Component on the screen, it should be overriden
by subclasses to perform custom drawing or invoke the UI API's to let
the PLAF perform the rendering.
|
void |
setSelected(boolean selected)
Selects the current radio button
|
String |
toString()
Overriden to return a useful value for debugging purposes
|
addActionListener, dragInitiated, fireClicked, getBorder, getCommand, getIconFromState, getPressedIcon, getPressedStyle, getRolloverIcon, getState, getStyle, isSelectableInteraction, keyPressed, keyReleased, keyRepeated, pointerHover, pointerHoverReleased, pointerPressed, pointerReleased, refreshTheme, removeActionListener, setPressedIcon, setPressedStyle, setRolloverIcon
animate, getAlignment, getBaselineResizeBehavior, getGap, getIcon, getShiftText, getText, getTextPosition, getVerticalAlignment, isEndsWith3Points, isTickerEnabled, isTickerRunning, paramString, setAlignment, setEndsWith3Points, setGap, setIcon, setShiftText, setText, setTextPosition, setTickerEnabled, setVerticalAlignment, shouldTickerStart, startTicker, stopTicker
addFocusListener, calcScrollSize, contains, deinitialize, deinitializeCustomStyle, focusGained, focusLost, getAbsoluteX, getAbsoluteY, getBaseline, getBottomGap, getBounds, getClientProperty, getComponentForm, getDirtyRegion, getHeight, getLabelForComponent, getNextFocusDown, getNextFocusLeft, getNextFocusRight, getNextFocusUp, getParent, getPreferredH, getPreferredSize, getPreferredW, getScrollAnimationSpeed, getScrollDimension, getScrollX, getScrollY, getSelectCommandText, getSelectedStyle, getSideGap, getUIID, getUnselectedStyle, getVisibleBounds, getWidth, getX, getY, handlesInput, hasFocus, initComponent, initCustomStyle, isBorderPainted, isDragActivated, isEnabled, isFocusable, isFocusPainted, isInitialized, isRTL, isScrollable, isScrollableX, isScrollableY, isScrollVisible, isSmoothScrolling, isTactileTouch, isTactileTouch, isTensileDragEnabled, isVisible, laidOut, longKeyPress, longPointerPress, paintBackground, paintBackgrounds, paintBorder, paintComponent, paintComponent, paintScrollbars, paintScrollbarX, paintScrollbarY, pointerDragged, pointerDragged, pointerPressed, pointerReleased, putClientProperty, refreshTheme, removeFocusListener, repaint, repaint, requestFocus, scrollRectToVisible, scrollRectToVisible, setBorderPainted, setCellRenderer, setDirtyRegion, setEnabled, setFocus, setFocusable, setFocusPainted, setHandlesInput, setHeight, setInitialized, setIsScrollVisible, setLabelForComponent, setNextFocusDown, setNextFocusLeft, setNextFocusRight, setNextFocusUp, setPreferredH, setPreferredSize, setPreferredW, setRTL, setScrollAnimationSpeed, setScrollSize, setScrollX, setScrollY, setSelectCommandText, setSelectedStyle, setShouldCalcPreferredSize, setSize, setSmoothScrolling, setStyle, setTactileTouch, setTensileDragEnabled, setUIID, setUnselectedStyle, setUnSelectedStyle, setVisible, setWidth, setX, setY, styleChanged
public RadioButton(String text)
text
- to display next to the buttonpublic RadioButton()
public RadioButton(Image icon)
icon
- icon to show next to the buttonpublic String toString()
Component
public boolean isSelected()
isSelected
in class Button
public void setSelected(boolean selected)
selected
- value for selectionpublic void paint(Graphics g)
Component
protected Dimension calcPreferredSize()
Component
calcPreferredSize
in class Button