// Create the popup dialog box
final DialogBox dialogBox = new DialogBox();
dialogBox.setText("Title of dialog box");
dialogBox.setAnimationEnabled(true);
final Button closeButton = new Button("Close");
// We can set the id of a widget by accessing its Element
closeButton.getElement().setId("closeButton");
final Label lblFirstSection = new Label();
final HTML htmlSecondSection = new HTML();
VerticalPanel dialogVPanel = new VerticalPanel();
dialogVPanel.addStyleName("dialogVPanel");
dialogVPanel.add(new HTML("<b>First section:</b>"));
dialogVPanel.add(lblFirstSection);
dialogVPanel.add(new HTML("<br><b>Second section:</b>"));
dialogVPanel.add(htmlSecondSection);
dialogVPanel.setHorizontalAlignment(VerticalPanel.ALIGN_RIGHT);
dialogVPanel.add(closeButton);
dialogBox.setWidget(dialogVPanel);

// Add a handler to close the DialogBox
closeButton.addClickHandler(new ClickHandler() {
	public void onClick(ClickEvent event) {
		dialogBox.hide();
		sendButton.setEnabled(true);
		sendButton.setFocus(true);
	}
});