package com.rntsoft.gwt.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.Grid;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.RootPanel;
import com.google.gwt.user.client.ui.TextBox;
import com.google.gwt.user.client.ui.Widget;
public class GWTClient implements EntryPoint{
Label nameLabel = new Label("Name:");
TextBox nameBox = new TextBox();
Label addrLabel = new Label("Address:");
TextBox addrBox = new TextBox();
Label phoneLabel = new Label("Phone number:");
TextBox phoneBox = new TextBox();
Button button = new Button("Submit");
Grid grid = new Grid(4, 2);
public void onModuleLoad() {
grid.setWidget(0, 0, nameLabel);
grid.setWidget(0, 1, nameBox);
grid.setWidget(1, 0, addrLabel);
grid.setWidget(1, 1, addrBox);
grid.setWidget(2, 0, phoneLabel);
grid.setWidget(2, 1, phoneBox);
grid.setWidget(3, 1, button);
RootPanel.get().add(grid);
button.addClickListener(new ClickListener() {
public void onClick(Widget sender) {
grid.setVisible(false);
RootPanel.get().add(
new Label("Thanks for your submission."));
Window.alert("Submit name=" + nameBox.getText()
+ "\naddress=" + addrBox.getText() + "\nphone="
+ phoneBox.getText());
}
});
}
}
GWT-form.zip( 2 k)