This article assumes that you followed the previous step in "Setting up a new GWT project - part 1".
We will try to extend the previous functionality which just displayed the content of "Main.html" file and create a simple GWT element.
Here are the steps that we will work with:
- Add css and images directories for later styling
- Main.gwt.xml
This file at this point only defines the application entry point Main.java
- Main.html
This file does not change much, but it includes the compiled JavaScript
<script language='javascript' src='com.taktico.Main.nocache.js' type="text/javascript">
- Main.java
This is a very basic GWT functionality:
package com.taktico.client;
import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.RootPanel;
/** @author Uki D. Lucas */
public class Main implements EntryPoint
{
public Main()
{
RootPanel.get("page").add(new Label("GWT! 1"));
}
public void onModuleLoad()
{
RootPanel.get("page").add(new Label("GWT! 2"));
Window.alert("done loading!");
}
}
Here is the screenshot of Main.gwt.xml and Main.html
And here is the resulting application!
At this point you have the client side GWT working, all you have to do is to add some services...
Side note:
MyEclipse 6.5 Maven dependencies drives me nuts, I frequently switch to MyEclipse 5.0 and all seems to work fine.
No comments:
Post a Comment