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. |
addPopupListener(PopupListener) | Adds a listener interface to receive popup events. |
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. |
hide() | Hides the popup. |
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 any other widget. |
onKeyPressPreview(char, int) | Popups get an opportunity to preview keyboard events before they are passed to any other widget. |
onKeyUpPreview(char, int) | Popups get an opportunity to preview keyboard events before they are passed to any other widget. |
remove(Widget) | |
removePopupListener(PopupListener) | Removes a previously added popup listener. |
setPopupPosition(int, int) | Sets the popup's position relative to the browser's client area. |
show() | Shows the popup. |
true
if the popup should be automatically
hidden when the user clicks outside of itfalse
to cancel the eventfalse
to suppress the eventfalse
to suppress the eventfalse
to suppress the event