public ImageToggleButtonSample() {
HorizontalPanel buttons = new HorizontalPanel();
Image image = WidgetImages.Instance.get().notification_WarningLarge().createImage();
ImageToggleButton button = new ImageToggleButton(image);
button.addToggleHandler(new ToggleHandler() {
public void onToggle(ToggleEvent event) {
if (!event.getState()) {
showMessage("Warning");
}
}
});
button.setGroup("group");
buttons.add(button);
addGap(buttons, "10px");
image = WidgetImages.Instance.get().notification_ErrorLarge().createImage();
button = new ImageToggleButton(image);
button.addToggleHandler(new ToggleHandler() {
public void onToggle(ToggleEvent event) {
if (!event.getState()) {
showMessage("Error");
}
}
});
button.setGroup("group");
buttons.add(button);
SimplePanel main = new SimplePanel();
main.setWidget(buttons);