GWT RootPanel

GWT RootPanel is the starting or the top most panel to which all other Widgets are attached. To access the root panel in the application, we can use this syntax: RootPanel.get().

This panel consists of html pages. Root panel returns the singleton value that binds the GWT application. For control modification in web-app we can change the syntax as follows: RootPanel.get(String argument).

GWT RootPanel Class Declaration

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

GWT RootPanel methods

Modifier and TypesMethodDescription
voidclear(boolean clearDom))It removes all the Dom elements that can cause issues with other elements in page.
static voiddetachNow(Widget widget)It marks a widget as detached and removes it from the detach list.
static voiddetachOnWindowClose(Widget widget)It adds a widget to detach list.
static RootPanelget(java.lang.String id)It gets the RootPanel associated with browser element
static ElementgetBodyElement()It is a simple method for gettin document body element.
static booleanisInDetachList(Widget widget)It determines the given widget is in detach list.

GWT RootPanel Example

//SampleRootPanel.java

Output:

GWT RootPanel
Next TopicGWT FlowPanel




Latest Courses