DialogBox
public class PopupPanelExample implements EntryPoint, ClickListener { private static class MyPopup extends PopupPanel { public MyPopup() { // PopupPanel's constructor takes 'auto-hide' as its boolean parameter. // If this is set, the panel closes itself automatically when the user // clicks outside of it. super(true); // PopupPanel 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 popup and show it. new MyPopup().show(); } }
PopupPanel() | Creates an empty popup panel. |
PopupPanel(boolean) | Creates an empty popup panel, specifying its "auto-hide" property. |
PopupPanel(boolean, boolean) | Creates an empty popup panel, specifying its "auto-hide" property. |
addPopupListener(PopupListener) | Adds a listener interface to receive popup events. |
center() | Centers the popup in the browser window. |
getContainerElement() | Override this method to specify that an element other than the root element be the container for the panel's child widget. |
getPopupLeft() | Gets the popup's left position relative to the browser's client area. |
getPopupTop() | Gets the popup's top position relative to the browser's client area. |
getStyleElement() | Template method that returns the element to which style names will be applied. |
getTitle() | Gets the title associated with this object. |
hide() | Hides the popup. |
onDetach() | This method is called when a widget is detached from the browser's document. |
onEventPreview(Event) | Called when a browser event occurs and this event preview is on top of the preview stack. |
onKeyDownPreview(char, int) | Popups get an opportunity to preview keyboard events before they are passed to a widget contained by the Popup. |
onKeyPressPreview(char, int) | Popups get an opportunity to preview keyboard events before they are passed to a widget contained by the Popup. |
onKeyUpPreview(char, int) | Popups get an opportunity to preview keyboard events before they are passed to a widget contained by the Popup. |
removePopupListener(PopupListener) | Removes a previously added popup listener. |
setHeight(String) | Sets the object's height. |
setPopupPosition(int, int) | Sets the popup's position relative to the browser's client area. |
setTitle(String) | Sets the title associated with this object. |
setVisible(boolean) | Sets whether this object is visible. |
setWidget(Widget) | Sets this panel's widget. |
setWidth(String) | Sets the object's width. |
show() | Shows the popup. |
true
if the popup should be automatically
hidden when the user clicks outside of ittrue
if the popup should be automatically
hidden when the user clicks outside of ittrue
if keyboard or mouse events that do not
target the PopupPanel or its children should be ignoredNote that the popup must be shown before this method is called.
false
to cancel the eventfalse
to suppress the eventfalse
to suppress the eventfalse
to suppress the eventtrue
to show the object, false
to hide itnull
will clear the panel)