public class DialogBoxExample implements EntryPoint, ClickListener { private static class MyDialog extends DialogBox { public MyDialog() { // Set the dialog box's caption. setText("My First Dialog"); // DialogBox is a SimplePanel, so you have to set it's widget property to // whatever you want its contents to be. Button ok = new Button("OK"); ok.addClickListener(new ClickListener() { public void onClick(Widget sender) { MyDialog.this.hide(); } }); setWidget(ok); } } public void onModuleLoad() { Button b = new Button("Click me"); b.addClickListener(this); RootPanel.get().add(b); } public void onClick(Widget sender) { // Instantiate the dialog box and show it. new MyDialog().show(); } }
DialogBox() | Creates an empty dialog box. |
DialogBox(boolean) | Creates an empty dialog box specifying its "auto-hide" property. |
getHTML() | Gets this object's contents as HTML. |
getText() | Gets this object's text. |
onMouseDown(Widget, int, int) | Fired when the user depresses the mouse button over a widget. |
onMouseEnter(Widget) | Fired when the mouse enters a widget's area. |
onMouseLeave(Widget) | Fired when the mouse leaves a widget's area. |
onMouseMove(Widget, int, int) | Fired when the user moves the mouse over a widget. |
onMouseUp(Widget, int, int) | Fired when the user releases the mouse button over a widget. |
remove(Widget) | |
setHTML(String) | Sets this object's contents via HTML. |
setText(String) | Sets this object's text. |
setWidget(Widget) | Sets this panel's widget. |
true
if the dialog should be automatically
hidden when the user clicks outside of itnull
will clear the panel)