public class RadioButton extends Button
Button
that maintains a selection state exclusively
within a specific ButtonGroup
STATE_DEFAULT, STATE_PRESSED, STATE_ROLLOVER
BASELINE, BOTTOM, BRB_CENTER_OFFSET, BRB_CONSTANT_ASCENT, BRB_CONSTANT_DESCENT, BRB_OTHER, CENTER, DRAG_REGION_LIKELY_DRAG_X, DRAG_REGION_LIKELY_DRAG_XY, DRAG_REGION_LIKELY_DRAG_Y, DRAG_REGION_NOT_DRAGGABLE, DRAG_REGION_POSSIBLE_DRAG_X, DRAG_REGION_POSSIBLE_DRAG_XY, DRAG_REGION_POSSIBLE_DRAG_Y, 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 |
---|---|
void |
bindProperty(String prop,
BindTarget target)
Binds the given property name to the given bind target
|
protected Dimension |
calcPreferredSize()
Calculates the preferred size based on component content.
|
String[] |
getBindablePropertyNames()
Returns the names of the properties within this component that can be bound for persistence,
the order of these names mean that the first one will be the first bound
|
Class[] |
getBindablePropertyTypes()
Returns the types of the properties that are bindable within this component
|
Object |
getBoundPropertyValue(String prop)
Allows the binding code to extract the value of the property
|
String |
getGroup()
This is a helper method to ease the usage of button groups
|
protected void |
initLaf(UIManager uim)
This method initializes the Component defaults constants
|
boolean |
isOppositeSide()
Places the radio box on the opposite side at the far end
|
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 |
released(int x,
int y)
Invoked to change the state of the button to the released state
|
void |
setBoundPropertyValue(String prop,
Object value)
Sets the value of a bound property within this component, notice that this method MUST NOT fire
the property change event when invoked to prevent recursion!
|
void |
setGroup(String groupName)
This is a helper method to ease the usage of button groups
|
void |
setOppositeSide(boolean oppositeSide)
Places the radio box on the opposite side at the far end
|
void |
setSelected(boolean selected)
Selects the current radio button
|
String |
toString()
Overriden to return a useful value for debugging purposes
|
void |
unbindProperty(String prop,
BindTarget target)
Removes a bind target from the given property name
|
addActionListener, animate, dragInitiated, fireClicked, getActionListeners, getBorder, getCommand, getDisabledIcon, getIconFromState, getListeners, getPressedIcon, getReleaseRadius, getRolloverIcon, getRolloverPressedIcon, getState, isSelectableInteraction, isToggle, keyPressed, keyReleased, keyRepeated, pointerDragged, pointerHover, pointerHoverReleased, pointerPressed, pointerReleased, pressed, released, removeActionListener, resetFocusable, setAlignment, setCommand, setDisabledIcon, setPressedIcon, setReleaseRadius, setRolloverIcon, setRolloverPressedIcon, setToggle
getAlignment, getBaseline, getBaselineResizeBehavior, getGap, getIcon, getMask, getMaskedIcon, getMaskName, getPropertyNames, getPropertyTypeNames, getPropertyTypes, getPropertyValue, getShiftMillimeters, getShiftText, getText, getTextPosition, getVerticalAlignment, isDefaultTickerEnabled, isEndsWith3Points, isShouldLocalize, isTickerEnabled, isTickerRunning, paramString, setDefaultTickerEnabled, setEndsWith3Points, setGap, setIcon, setMask, setMaskName, setPropertyValue, setShiftMillimeters, setShiftText, setShouldLocalize, setText, setTextPosition, setTickerEnabled, setVerticalAlignment, shouldTickerStart, startTicker, startTicker, stopTicker
addDragOverListener, addDropListener, addFocusListener, addPointerDraggedListener, addPointerPressedListener, addPointerReleasedListener, addPullToRefresh, addScrollListener, calcScrollSize, cancelRepaints, clearClientProperties, contains, deinitialize, deinitializeCustomStyle, dragEnter, dragExit, draggingOver, drawDraggedImage, drop, focusGained, focusLost, getAbsoluteX, getAbsoluteY, getBottomGap, getBounds, getClientProperty, getCloudBoundProperty, getCloudDestinationProperty, getComponentForm, getComponentState, getDirtyRegion, getDisabledStyle, getDraggedx, getDraggedy, getDragImage, getDragRegionStatus, getDragSpeed, getGridPosX, getGridPosY, getHeight, getLabelForComponent, getName, getNextFocusDown, getNextFocusLeft, getNextFocusRight, getNextFocusUp, getParent, getPreferredH, getPreferredSize, getPreferredW, getPressedStyle, getSameHeight, getSameWidth, getScrollable, getScrollAnimationSpeed, getScrollDimension, getScrollOpacity, getScrollOpacityChangeSpeed, getScrollX, getScrollY, getSelectCommandText, getSelectedRect, getSelectedStyle, getSideGap, getStyle, getTensileLength, getUIID, getUIManager, getUnselectedStyle, getVisibleBounds, getWidth, getX, getY, growShrink, handlesInput, hasFocus, initComponent, initCustomStyle, installDefaultPainter, isAlwaysTensile, isCellRenderer, isDragActivated, isDragAndDropOperation, isDraggable, isDragRegion, isDropTarget, isEnabled, isFlatten, isFocusable, isGrabsPointerEvents, isHideInPortrait, isInClippingRegion, isInitialized, isRTL, isScrollable, isScrollableX, isScrollableY, isScrollVisible, isSmoothScrolling, isSnapToGrid, isStickyDrag, isTactileTouch, isTactileTouch, isTensileDragEnabled, isVisible, laidOut, longKeyPress, longPointerPress, onScrollX, onScrollY, paintBackground, paintBackgrounds, paintBorder, paintComponent, paintComponent, paintLock, paintLockRelease, paintScrollbars, paintScrollbarX, paintScrollbarY, pinch, pointerDragged, pointerHoverPressed, pointerPressed, pointerReleased, putClientProperty, refreshTheme, refreshTheme, refreshTheme, removeDragOverListener, removeDropListener, removeFocusListener, removePointerDraggedListener, removePointerPressedListener, removePointerReleasedListener, removeScrollListener, repaint, repaint, requestFocus, scrollRectToVisible, scrollRectToVisible, setAlwaysTensile, setCellRenderer, setCloudBoundProperty, setCloudDestinationProperty, setComponentState, setDirtyRegion, setDisabledStyle, setDraggable, setDropTarget, setEnabled, setFlatten, setFocus, setFocusable, setGrabsPointerEvents, setHandlesInput, setHeight, setHideInPortrait, setInitialized, setIsScrollVisible, setLabelForComponent, setName, setNextFocusDown, setNextFocusLeft, setNextFocusRight, setNextFocusUp, setPreferredH, setPreferredSize, setPreferredW, setPressedStyle, setRTL, setSameHeight, setSameWidth, setScrollAnimationSpeed, setScrollOpacityChangeSpeed, setScrollSize, setScrollVisible, setScrollX, setScrollY, setSelectCommandText, setSelectedStyle, setShouldCalcPreferredSize, setSize, setSmoothScrolling, setSnapToGrid, setTactileTouch, setTensileDragEnabled, setTensileLength, setUIID, setUnselectedStyle, setVisible, setWidth, setX, setY, shouldBlockSideSwipe, styleChanged
public RadioButton(String text)
text
- to display next to the buttonpublic RadioButton()
public RadioButton(Image icon)
icon
- icon to show next to the buttonprotected void initLaf(UIManager uim)
Component
public String toString()
Component
public boolean isSelected()
isSelected
in class Button
public void setSelected(boolean selected)
selected
- value for selectionpublic void released(int x, int y)
Button
public void paint(Graphics g)
Component
protected Dimension calcPreferredSize()
Component
calcPreferredSize
in class Button
public void setGroup(String groupName)
groupName
- a name for the gouppublic String getGroup()
public boolean isOppositeSide()
isOppositeSide
in class Button
public void setOppositeSide(boolean oppositeSide)
oppositeSide
- the oppositeSide to setpublic String[] getBindablePropertyNames()
Component
getBindablePropertyNames
in class Label
public Class[] getBindablePropertyTypes()
Component
getBindablePropertyTypes
in class Label
public void bindProperty(String prop, BindTarget target)
Component
bindProperty
in class Label
prop
- the property nametarget
- the target binderpublic void unbindProperty(String prop, BindTarget target)
Component
unbindProperty
in class Label
prop
- the property namestarget
- the target binderpublic Object getBoundPropertyValue(String prop)
Component
getBoundPropertyValue
in class Label
prop
- the propertypublic void setBoundPropertyValue(String prop, Object value)
Component
setBoundPropertyValue
in class Label
prop
- the property whose value should be setvalue
- the value