01: /*
02: * MyGWT Widget Library
03: * Copyright(c) 2007, MyGWT.
04: * licensing@mygwt.net
05: *
06: * http://mygwt.net/license
07: */
08: package net.mygwt.samples.explorer.client;
09:
10: import net.mygwt.ui.client.Style;
11: import net.mygwt.ui.client.event.BaseEvent;
12: import net.mygwt.ui.client.event.SelectionListener;
13: import net.mygwt.ui.client.widget.Button;
14: import net.mygwt.ui.client.widget.ButtonBar;
15: import net.mygwt.ui.client.widget.Info;
16: import net.mygwt.ui.client.widget.WidgetContainer;
17: import net.mygwt.ui.client.widget.layout.FlowLayout;
18:
19: public class ButtonPage extends Page {
20:
21: protected void createWidget(WidgetContainer container) {
22: SelectionListener listener = new SelectionListener() {
23: public void widgetSelected(BaseEvent be) {
24: Button btn = (Button) be.widget;
25: Info.show("Click Event",
26: "The '{0}' button was clicked.", btn.getText());
27: }
28: };
29:
30: ButtonBar buttonBar = new ButtonBar(Style.LEFT);
31: buttonBar.add(new Button("Click Me", listener));
32:
33: Button iconBtn = new Button("Icon Button", listener);
34: iconBtn.setIconStyle("icon-printer");
35: buttonBar.add(iconBtn);
36:
37: Button disabled = new Button("Disabled", listener);
38: disabled.disable();
39: buttonBar.add(disabled);
40:
41: container.setLayout(new FlowLayout(10));
42: container.add(buttonBar);
43:
44: }
45: }
|