3.5. Manipulating the page

You can manipulate the browser page in one of two ways. The preferred way is to treat it as a panel—where GWT looks after you a lot—or via the DOM directly—the Wild West approach. We’ll look at both of these in this section, starting with the preferred approach.

3.5.1. Using the RootPanel/RootLayoutPanel

Manipulating the browser page to show your widgets is surprisingly easy, and you already know how to do that. The HTML page is generally treated as a panel—the RootPanel—and you use that panel’s add method.

 

Definition

The RootPanel provides access to the underlying HTML page.

 

You can’t create a RootPanel in your code; rather you get access to it by calling Root-Panel’s static get method. Accessing the ...

Get GWT in Action, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.