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); } }
CheckBox() | Creates a check box with no label. |
CheckBox(String) | Creates a check box with the specified text label. |
CheckBox(String, boolean) | Creates a check box with the specified text label. |
CheckBox(Element) |
getHTML() | |
getName() | Gets the widget's name. |
getTabIndex() | |
getText() | |
isChecked() | Determines whether this check box is currently checked. |
isEnabled() | Gets whether this widget is enabled. |
onLoad() | This method is called when a widget is attached to the browser's document. |
onUnload() | This method is called when a widget is detached from the browser's document. |
replaceInputElement(Element) | Replace the current input element with a new one. |
setAccessKey(char) | |
setChecked(boolean) | Checks or unchecks this check box. |
setEnabled(boolean) | Sets whether this widget is enabled. |
setFocus(boolean) | |
setHTML(String) | |
setName(String) | Sets the widget's name. |
setTabIndex(int) | |
setText(String) |
true
to treat the specified label as htmltrue
if the check box is checkedtrue
if the widget is enabledonAttach
contract.inputElem
.true
to check the check boxtrue
to enable the widget, false
to disable it