Google Web Toolkit (GWT) 2.0 Application Development

Using the HomePage instance in EntryPoint

To see the output of the created home page layout, we must add the HomePage instance in
the root panel at the entry point class.

Getting ready

Open the file

How to do it…

    1. Remove all previous code from the method onModuleLoad:
    2. Create an instance of the HomePage class in this method:

 HomePage homePage =new HomePage();
    1. Add the homepage instance in the RootPanel:

 RootPanel.get().a dd(homePage);

How it works…

After adding the HomePage instance in the RootPanel, if we run the project, we will get the
following output:


EntryPoint is an interface that allows a class to act as a module entry point. When a
module is loaded, each entry point class listed in the Main.gwt.xml file is instantiated and
its onModuleLoad method is called. When the host page is accessed by the browser, the
onModuleLoad function is called to display the first panels and widgets.


RootPanel corresponds to an HTML element on the host page. It can be used to add other
panels and widgets. A RootPanel is accessed by calling RootPanel.get(id), where id is
the value of the HTML ID attribute. The <body> element of the host page can be accessed by
calling RootPanel.get().

 RootPanels are never created directly. Instead, they are accessed via get().

Class and packages

The following table shows the class and its corresponding package

See also

  • The Creating the home page layout class recipe
  • The Adding the banner recipe
  • The Adding menus recipe
  • The Creating the left-hand sidebar recipe
  • The Creating the right-hand sidebar recipe
  • The Creating the main content panel recipe
  • The Creating the footer recipe

GWT Articles & Books

Pages: 1 2 3 4

Leave a Reply

Your email address will not be published. Required fields are marked *

Pin It on Pinterest

Share This

Share this post with your friends!