Setting up a new GWT project - part 2

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!");

    }

}


The Eclipse directory will look similar to this:


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.




As an Amazon Associate I earn from qualifying purchases.

My favorite quotations..


“A man should be able to change a diaper, plan an invasion, butcher a hog, conn a ship, design a building, write a sonnet, balance accounts, build a wall, set a bone, comfort the dying, take orders, give orders, cooperate, act alone, solve equations, analyze a new problem, pitch manure, program a computer, cook a tasty meal, fight efficiently, die gallantly. Specialization is for insects.”  by Robert A. Heinlein

"We are but habits and memories we chose to carry along." ~ Uki D. Lucas


Popular Recent Articles