Google Web Toolkit Tutorial

(ff) #1
<body>

<h1>Hello World</h1>

<div id="gwtContainer"></div>

</body>

</html>

I modified the HTML a little bit from the previous example. Here I created a placeholder


...
where we will insert some content using our entry point java class. So let us
have the following content of Java file **src/com.tutorialspoint/HelloWorld.java**.
package com.tutorialspoint.client;

import com.google.gwt.core.client.EntryPoint;

import com.google.gwt.user.client.ui.HTML;

import com.google.gwt.user.client.ui.RootPanel;

public class HelloWorld implements EntryPoint {

public void onModuleLoad() {

HTML html = new HTML("<p>Welcome to GWT application</p>");

RootPanel.get("gwtContainer").add(html);

}

}

Here we created a basic widget HTML and added it inside the div tag having the
id="gwtContainer". We will study different GWT widgets in the coming chapters.


Once you are ready with all the changes done, let us compile and run the application in
development mode as we did in GWT - Create Application chapter. If everything is fine with
your application, then this will produce the following result:

Free download pdf