Class CheckBox
A standard check box widget (also serves as a base class for
RadioButton.

CSS Style Rules
Example
public class CheckBoxExample implements EntryPoint {
public void onModuleLoad() {
// Make a new check box, and select it by default.
CheckBox cb = new CheckBox("Foo");
cb.setChecked(true);
// Hook up a listener to find out when it's clicked.
cb.addClickListener(new ClickListener() {
public void onClick(Widget sender) {
boolean checked = ((CheckBox) sender).isChecked();
Window.alert("It is " + (checked ? "" : "not") + "checked");
}
});
// Add it to the root panel.
RootPanel.get().add(cb);
}
}
Constructors
Methods
Constructor Detail
CheckBox
public CheckBox()
Creates a check box with no label.
CheckBox
Creates a check box with the specified text label.
Parameters
- label
- the check box's label
CheckBox
public
CheckBox(
String label, boolean asHTML)
Creates a check box with the specified text label.
Parameters
- label
- the check box's label
- asHTML
-
CheckBox
Parameters
- elem
-
Method Detail
getHTML
getText
isChecked
public boolean isChecked()
Determines whether this check box is currently checked.
Return Value
true
if the check box is checked
isEnabled
public boolean isEnabled()
Gets whether this widget is enabled.
Return Value
true
if the widget is enabled
setChecked
public void setChecked(boolean checked)
Checks or unchecks this check box.
Parameters
- checked
-
true
to check the check box
setEnabled
public void setEnabled(boolean enabled)
Sets whether this widget is enabled.
Parameters
- enabled
-
true
to enable the widget, false
to disable it
setHTML
public void
setHTML(
String html)
Parameters
- html
-
setText
public void
setText(
String text)
Parameters
- text
-