ToggleButton
is a stylish stateful button which allows the
user to toggle between up
and down
states.
public class ToggleButtonExample implements EntryPoint { public void onModuleLoad() { // Make a new button that does something when you click it. final ToggleButton toggleButton = new ToggleButton("Up", "Down"); toggleButton.addClickListener(new ClickListener() { public void onClick(Widget sender) { if (toggleButton.isDown()) { Window.alert("I have been toggled down"); } else { Window.alert("I have been toggled up"); } } }); // In a real application, you would have to have css styles defined for // gwt-ToggleButton-up,gwt-ToggleButton-up-hovering,gwt-ToggleButton-up-disabled, // gwt-ToggleButton-down,.gwt-ToggleButton-down-hovering,.gwt-ToggleButton-down-disabled // Add the ToggleButton to the root panel. RootPanel.get().add(toggleButton); } }
ToggleButton() | Constructor for ToggleButton . |
ToggleButton(Image) | Constructor for ToggleButton . |
ToggleButton(Image, ClickListener) | Constructor for ToggleButton . |
ToggleButton(Image, Image) | Constructor for ToggleButton . |
ToggleButton(Image, Image, ClickListener) | Constructor for ToggleButton . |
ToggleButton(String) | Constructor for ToggleButton . |
ToggleButton(String, ClickListener) | Constructor for ToggleButton . |
ToggleButton(String, String) | Constructor for ToggleButton . |
isDown() | Is this button down? |
onClick() | Called when the user finishes clicking on this button. |
setDown(boolean) | Sets whether this button is down. |
ToggleButton
.ToggleButton
. The supplied image is used to
construct the default face.ToggleButton
. The supplied image is used to
construct the default face of the button.ToggleButton
.ToggleButton
.ToggleButton
. The supplied text is used to
construct the default face of the button.ToggleButton
. The supplied text is used to
construct the default face of the button.ToggleButton
.true
if the button is downtrue
to press the button, false
otherwise