GWT DialogBox

GWT DialogBox has a caption area at the top and can be dragged by the user.GWT DialogBox, calls to PopupPanel.setWidth(String) and PopupPanel.setHeight(String) will set the width and height of the dialog box.

GWT DialogBox Class Declaration

Let's see the declaration of com.google.gwt.user.client.ui.DialogBox

GWT DialogBox Nested Classes

ClassDescription
DialogBox.CaptionIt is a set of characteristic interfaces supported by the DialogBox caption.
DialogBox.CaptionImplIt is a default implementation of Caption.

GWT DialogBox Constructors

ConstructorDescription
DialogBox()It creates an empty dialog box.
DialogBox(boolean autoHide)It creates an empty dialog box specifying its "auto-hide" property.
DialogBox(boolean autoHide, boolean modal)It creates an empty dialog box specifying its "auto-hide" and "modal" properties.
DialogBox(boolean autoHide, boolean modal, DialogBox.Caption captionWidget)It creates an empty dialog box specifying its "auto-hide", "modal" properties and an implementation a custom DialogBox.Caption.

GWT DialogBox Common Methods

Modifier and TypesMethodDescription
protected voidbeginDragging(MouseDownEvent event)It is called on mouse down in the caption area, begins the dragging loop by turning on event capture.
protected voiddoAttachChildren()If a widget contains one or more child widgets that are not in the logical widget hierarchy (the child is physically connected only on the DOM level), it must override this method and call Widget.onAttach() for each of its child widgets.
protected voiddoDetachChildren()If a widget contains one or more child widgets that are not in the logical widget hierarchy (the child is physically connected only on the DOM level), it must override this method and call Widget.onDetach() for each of its child widgets.
voidhide(boolean autoClosed)It hides the popup and detaches it from the page.
voidonBrowserEvent(Event event)It is called whenever a browser event is received.
protected voidonPreviewNativeEvent(Event.NativePreviewEvent event)It creates the preview.
voidsetHTML(SafeHtml html)It sets the html string inside the caption by calling its setHTML(SafeHtml) method.
voidsetHTML(java.lang.String html)It sets the html string inside the caption by calling its setHTML(SafeHtml) method.
voidsetText(java.lang.String text)It sets the text inside the caption by calling its setText(String) method.
voidshow()It shows the popup and attach it to the page.

GWT DialogBox Example 1

//SampleDialogBox1.java

Output:

GWT DialogBox

GWT DialogBox Example 2

//SampleDialogBox2.java

Output:

GWT DialogBox
Next TopicGWT DateBox