You can create user interfaces using widgets like button, tree, tab, menubar or textbox, which work in most browsers. You can even create your own widget.
GWT widgets rely on cascading style sheets (CSS) for visual styling.
A simple application that has a button that displays a message when clicked will have a code like this:
package com.google.gwt.sample.hello.client;
import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.ClickListener;
import com.google.gwt.user.client.ui.RootPanel;
import com.google.gwt.user.client.ui.Widget;
public class Hello implements EntryPoint {
public void onModuleLoad() {
Button b = new Button("Click me", new ClickListener() {
public void onClick(Widget sender) {
Window.alert("Hello, AJAX");
}
});
RootPanel.get().add(b);
}
}
The Java code will be translated to JavaScript and HTML and the resulting "Hello World" can be seen here. You will say it's unimpressive, but what about this Desktop Mail Clone or this Dynamic School Schedule? You can find other examples and the source code.
GWT applications can be run in hosted mode (usually during development) within JVM and in web mode, as JavaScript+HTML .
The toolkit is available for Windows (13.9 MB) and Linux (23.9 MB) and includes the GWT compiler, hosted web browser, class libraries, and some demo projects. The GWT Java class libraries are open source and licensed under Apache License 2.0.
GWT was used for Google Maps and Google Calendar.
No comments:
Post a Comment