Source Code : Create a form with GWT controls

Java Is Open Source Programming Language You Can Download From Java and Java Libraries From http://www.oracle.com. Click Here to download
We provide this code related to title for you to solve your developing problem easily. Libraries which is import in this program you can download from http://www.oracle.com. Click Here or search from google with Libraries Name you get jar file related it

Create a form with GWT controls

 

package com.java2s.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()
                  + "
address=" + addrBox.getText() + "
phone="
                  + phoneBox.getText());
         }
      });
   }
}


           
         
  

Thank with us