Class DialogBox
A form of popup that has a caption area at the top and can be dragged by the
user.

CSS Style Rules
- .gwt-DialogBox { the outside of the dialog }
- .gwt-DialogBox .Caption { the caption }
Example
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.
setWidget(new Label("Click outside of this popup to close it"));
}
}
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();
}
}
Constructors
Methods
Constructor Detail
DialogBox
public DialogBox()
Creates an empty dialog box. It should not be shown until its child widget
has been added using
add.
Method Detail
add
Parameters
- w
-
getHTML
Gets this object's contents as HTML.
Return Value
the object's HTML
getText
Gets this object's text.
Return Value
the object's text
onMouseDown
public void
onMouseDown(
Widget sender, int x, int y)
Fired when the user depresses the mouse button over a widget.
Parameters
- sender
- the widget sending the event
- x
- the x coordinate of the mouse
- y
- the y coordinate of the mouse
onMouseEnter
public void
onMouseEnter(
Widget sender)
Fired when the mouse enters a widget's area.
Parameters
- sender
- the widget sending the event
onMouseLeave
public void
onMouseLeave(
Widget sender)
Fired when the mouse enters a widget's area.
Parameters
- sender
- the widget sending the event
onMouseMove
public void
onMouseMove(
Widget sender, int x, int y)
Fired when the user moves the mouse over a widget.
Parameters
- sender
- the widget sending the event
- x
- the x coordinate of the mouse
- y
- the y coordinate of the mouse
onMouseUp
public void
onMouseUp(
Widget sender, int x, int y)
Fired when the user releases the mouse button over a widget.
Parameters
- sender
- the widget sending the event
- x
- the x coordinate of the mouse
- y
- the y coordinate of the mouse
remove
public boolean
remove(
Widget w)
Parameters
- w
-
setHTML
public void
setHTML(
String html)
Sets this object's contents via HTML. Use care when setting an object's
HTML; it is an easy way to expose script-based security problems. Consider
using
setText whenever possible.
Parameters
- html
- the object's new HTML
setText
public void
setText(
String text)
Sets this object's text.
Parameters
- text
-