public class CheckBox extends Button
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 |
---|
CheckBox()
Constructs a checkbox with no text
|
CheckBox(Image icon)
Constructs a checkbox with the given icon
|
CheckBox(String text)
Constructs a checkbox with the given text
|
CheckBox(String text,
Image icon)
Constructs a checkbox 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()
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 String |
paramString()
Returns a string representing the state of this component.
|
void |
setSelected(boolean selected)
Selects the current checkbox
|
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, 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, toString
public CheckBox(String text)
text
- to display next to the checkboxpublic CheckBox()
public CheckBox(Image icon)
icon
- icon to display next to the checkboxpublic 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
protected String paramString()
Component
null
.paramString
in class Label