com.sun.lwuit
Class CheckBox

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.CheckBox
All Implemented Interfaces:
Animation, StyleListener

public class CheckBox
extends Button

Checkbox is a button that can be selected or deselected, and which displays its state to the user.


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
CheckBox()
          Constructs a checkbox with no text
CheckBox(Image icon)
          Constructs a checkbox with the given icon
CheckBox(java.lang.String text)
          Constructs a checkbox with the given text
CheckBox(java.lang.String text, Image icon)
          Constructs a checkbox with the given text and icon
 
Method Summary
protected  Dimension calcPreferredSize()
          Calculates the preferred size based on component content.
 boolean isOppositeSide()
          Places the check box on the opposite side at the far end
 boolean isSelected()
          Return true if the checkbox 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.
protected  java.lang.String paramString()
          Returns a string representing the state of this component.
 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 setOppositeSide(boolean oppositeSide)
          Places the check box on the opposite side at the far end
 void setSelected(boolean selected)
          Selects the current checkbox
 
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, 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, toString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CheckBox

public CheckBox(java.lang.String text)
Constructs a checkbox with the given text

Parameters:
text - to display next to the checkbox

CheckBox

public CheckBox()
Constructs a checkbox with no text


CheckBox

public CheckBox(Image icon)
Constructs a checkbox with the given icon

Parameters:
icon - icon to display next to the checkbox

CheckBox

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

Parameters:
text - to display next to the checkbox
icon - icon to display next to the text
Method Detail

isSelected

public boolean isSelected()
Return true if the checkbox is selected

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

setSelected

public void setSelected(boolean selected)
Selects the current checkbox

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

paramString

protected java.lang.String paramString()
Description copied from class: Component
Returns a string representing the state of this component. This method is intended to be used only for debugging purposes, and the content and format of the returned string may vary between implementations. The returned string may be empty but may not be null.

Overrides:
paramString in class Label
Returns:
a string representation of this component's state

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

isOppositeSide

public boolean isOppositeSide()
Places the check 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 check box on the opposite side at the far end

Parameters:
oppositeSide - the oppositeSide to set