GWT PopupPanel

GWT PopupPanel can be optionally displayed with a "glass" element behind it, which is commonly used to gray out the widgets behind it. It can be enabled using setGlassEnabled(boolean). It has a default style name of "gwt-PopupPanelGlass", which can be changed using setGlassStyleName(String).

GWT PopupPanel Class Declaration

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

GWT PopupPanel Nested Class

ClassDescription
PopupPanel.AnimationTypeIt is the type of animation to use when opening the popup.
PopupPanel.PositionCallbackIt is a callback that is used to set the position of a PopupPanel right before it is shown.
PopupPanel.ResizeAnimationIt is used to enlarge the popup into view.

GWT PopupPanel Constructors

ConstructorDescription
PopupPanel()It creates an empty popup panel.
PopupPanel(boolean autoHide)It creates an empty popup panel, specifying its "auto-hide" property.
PopupPanel(boolean autoHide, boolean modal)It creates an empty popup panel, specifying its "auto-hide" and "modal" properties.

GWT PopupPanel Common Methods

Modifier and TypesMethodDescription
voidaddAutoHidePartner(Element partner)It is a mouse events that occur within an autoHide partner will not hide a panel set to autoHide.
voidcenter()It centers the popup in the browser window and shows it.
PopupPanel.AnimationTypegetAnimationType()It get the type of animation to use when opening and closing the popup.
protected ElementgetContainerElement()It override this method to specify that an element other than the root element be the container for the panel's child widget.
protected ElementgetGlassElement()It get the glass element used by this PopupPane
intgetOffsetHeight()It gets the panel's offset height in pixels.
intgetOffsetWidth()It gets the panel's offset width in pixels.
voidhide()It hides the popup and detaches it from the page.
voidhide(boolean autoClosed)It hides the popup and detaches it from the page.
booleanisAnimationEnabled()It returns true if animations are enabled, false if not.
booleanisModal()It returns true if keyboard or mouse events that do not target the PopupPanel or its children should be ignored.
booleanisPreviewingAllNativeEvents()It returns true if the popup should preview all native events, even if the event has already been consumed by another popup.
voidsetModal(boolean modal)When the popup is modal, keyboard or mouse events that do not target the PopupPanel or its children will be ignored.
voidsetAnimationType(PopupPanel.AnimationType type)It set the type of animation to use when opening and closing the popup.

GWT PopupPanel Example 1

//SamplePopupPanel.java

//SamplePopupPanel.css

Output:

GWT PopupPanel

GWT PopupPanel Example 2

//SamplePopupPanel.java

Output:

GWT PopupPanel
Next TopicGWT DialogBox




Latest Courses