com.sun.lwuit
Class RadioButton

java.lang.Object
  extended by com.sun.lwuit.Component
      extended by com.sun.lwuit.Label
          extended by com.sun.lwuit.Button
              extended by com.sun.lwuit.RadioButton
All Implemented Interfaces:
Animation, StyleListener

public class RadioButton
extends Button

RadioButton is a Button that maintains a selection state exclusively within a specific ButtonGroup


Field Summary
 
Fields inherited from class com.sun.lwuit.Button
STATE_DEFAULT, STATE_PRESSED, STATE_ROLLOVER
 
Fields inherited from class com.sun.lwuit.Component
BOTTOM, BRB_CENTER_OFFSET, BRB_CONSTANT_ASCENT, BRB_CONSTANT_DESCENT, BRB_OTHER, CENTER, LEFT, RIGHT, TOP
 
Constructor Summary
RadioButton()
          Creates an empty radio button
RadioButton(Image icon)
          Constructs a radio with the given icon
RadioButton(java.lang.String text)
          Constructs a radio with the given text
RadioButton(java.lang.String text, Image icon)
          Constructs a radio with the given text and icon
 
Method Summary
protected  Dimension calcPreferredSize()
          Calculates the preferred size based on component content.
 java.lang.String getGroup()
          This is a helper method to ease the usage of button groups
 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 refreshTheme()
          Makes sure the component is up to date with the current style object
 void released(int x, int y)
          Invoked to change the state of the button to the released state
 void setGroup(java.lang.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
 java.lang.String toString()
          Overriden to return a useful value for debugging purposes
 
Methods inherited from class com.sun.lwuit.Button
addActionListener, animate, dragInitiated, fireClicked, getBorder, getCommand, getDisabledIcon, getIconFromState, getPressedIcon, getRolloverIcon, getRolloverPressedIcon, getState, isSelectableInteraction, isToggle, keyPressed, keyReleased, keyRepeated, pointerDragged, pointerHover, pointerHoverReleased, pointerPressed, pointerReleased, pressed, released, removeActionListener, setAlignment, setCommand, setDisabledIcon, setPressedIcon, setRolloverIcon, setRolloverPressedIcon, setToggle
 
Methods inherited from class com.sun.lwuit.Label
getAlignment, getBaselineResizeBehavior, getGap, getIcon, getShiftText, getText, getTextPosition, getVerticalAlignment, isDefaultTickerEnabled, isEndsWith3Points, isTickerEnabled, isTickerRunning, paramString, setDefaultTickerEnabled, setEndsWith3Points, setGap, setIcon, setShiftText, setText, setTextPosition, setTickerEnabled, setVerticalAlignment, shouldTickerStart, startTicker, startTicker, stopTicker
 
Methods inherited from class com.sun.lwuit.Component
addFocusListener, calcScrollSize, contains, deinitialize, deinitializeCustomStyle, dragEnter, dragExit, draggingOver, drawDraggedImage, drop, focusGained, focusLost, getAbsoluteX, getAbsoluteY, getBaseline, getBottomGap, getBounds, getClientProperty, getComponentForm, getDirtyRegion, getDisabledStyle, getDragImage, getGridPosX, getGridPosY, getHeight, getLabelForComponent, getName, getNextFocusDown, getNextFocusLeft, getNextFocusRight, getNextFocusUp, getParent, getPreferredH, getPreferredSize, getPreferredW, getPressedStyle, getPropertyNames, getPropertyTypes, getPropertyValue, getScrollAnimationSpeed, getScrollDimension, getScrollOpacity, getScrollOpacityChangeSpeed, getScrollX, getScrollY, getSelectCommandText, getSelectedRect, getSelectedStyle, getSideGap, getStyle, getTensileLength, getUIID, getUnselectedStyle, getWidth, getVisibleBounds, getX, getY, growShrink, handlesInput, hasFocus, initComponent, initCustomStyle, installDefaultPainter, isAlwaysTensile, isDragActivated, isDragAndDropOperation, isDraggable, isDropTarget, isEnabled, isFlatten, isFocusable, isGrabsPointerEvents, isHideInPortrait, isInitialized, isRTL, isScrollable, isScrollableX, isScrollableY, isScrollVisible, isSmoothScrolling, isSnapToGrid, isTactileTouch, isTactileTouch, isTensileDragEnabled, isVisible, laidOut, longKeyPress, longPointerPress, paintBackground, paintBackgrounds, paintBorder, paintComponent, paintComponent, paintLock, paintLockRelease, paintScrollbars, paintScrollbarX, paintScrollbarY, pointerDragged, pointerHoverPressed, pointerPressed, pointerReleased, putClientProperty, refreshTheme, removeFocusListener, repaint, repaint, requestFocus, scrollRectToVisible, scrollRectToVisible, setAlwaysTensile, setCellRenderer, setDirtyRegion, setDisabledStyle, setDraggable, setDropTarget, setEnabled, setFlatten, setFocus, setFocusable, setGrabsPointerEvents, setHandlesInput, setHeight, setHideInPortrait, setInitialized, setIsScrollVisible, setLabelForComponent, setName, setNextFocusDown, setNextFocusLeft, setNextFocusRight, setNextFocusUp, setPreferredH, setPreferredSize, setPreferredW, setPressedStyle, setPropertyValue, setRTL, setScrollAnimationSpeed, setScrollOpacityChangeSpeed, setScrollSize, setScrollVisible, setScrollX, setScrollY, setSelectCommandText, setSelectedStyle, setShouldCalcPreferredSize, setSize, setSmoothScrolling, setSnapToGrid, setTactileTouch, setTensileDragEnabled, setTensileLength, setUIID, setUnselectedStyle, setWidth, setVisible, setX, setY, styleChanged
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

RadioButton

public RadioButton(java.lang.String text)
Constructs a radio with the given text

Parameters:
text - to display next to the button

RadioButton

public RadioButton()
Creates an empty radio button


RadioButton

public RadioButton(Image icon)
Constructs a radio with the given icon

Parameters:
icon - icon to show next to the button

RadioButton

public RadioButton(java.lang.String text,
                   Image icon)
Constructs a radio with the given text and icon

Parameters:
text - to display next to the button
icon - icon to show next to the button
Method Detail

toString

public java.lang.String toString()
Description copied from class: Component
Overriden to return a useful value for debugging purposes

Overrides:
toString in class Component
Returns:
a string representation of this component

isSelected

public boolean isSelected()
Returns true if the radio button is selected

Overrides:
isSelected in class Button
Returns:
true if the radio button is selected

setSelected

public void setSelected(boolean selected)
Selects the current radio button

Parameters:
selected - value for selection

released

public void released(int x,
                     int y)
Description copied from class: Button
Invoked to change the state of the button to the released state

Overrides:
released in class Button
Parameters:
x - the x position if a touch event triggered this, -1 if this isn't relevant
y - the y position if a touch event triggered this, -1 if this isn't relevant

paint

public void paint(Graphics g)
Description copied from class: Component
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.

Specified by:
paint in interface Animation
Overrides:
paint in class Button
Parameters:
g - the component graphics

calcPreferredSize

protected Dimension calcPreferredSize()
Description copied from class: Component
Calculates the preferred size based on component content. This method is invoked lazily by getPreferred size.

Overrides:
calcPreferredSize in class Button
Returns:
the calculated preferred size based on component content

setGroup

public void setGroup(java.lang.String groupName)
This is a helper method to ease the usage of button groups

Parameters:
groupName - a name for the goup

refreshTheme

public void refreshTheme()
Description copied from class: Component
Makes sure the component is up to date with the current style object

Overrides:
refreshTheme in class Component

getGroup

public java.lang.String getGroup()
This is a helper method to ease the usage of button groups

Returns:
the name of the group

isOppositeSide

public boolean isOppositeSide()
Places the radio box on the opposite side at the far end

Overrides:
isOppositeSide in class Button
Returns:
the oppositeSide

setOppositeSide

public void setOppositeSide(boolean oppositeSide)
Places the radio box on the opposite side at the far end

Parameters:
oppositeSide - the oppositeSide to set