Add two controls to RootPanel : RootPanel « GWT « Java






Add two controls to RootPanel


package com.java2s.gwt.client;


import com.google.gwt.core.client.*;
import com.google.gwt.user.client.ui.*;

public class GWTClient implements EntryPoint{

   public void onModuleLoad() {
      final Button button = new Button("Click me");
      final Label label = new Label();
      
      button.addClickListener(new ClickListener() {
         public void onClick(Widget sender) {
            if (label.getText().equals(""))
               label.setText("Hello World!");
            else
               label.setText("");
         }
      });
      
      RootPanel.get("slot1").add(button);
      RootPanel.get("slot2").add(label);
      
   }
   
}

           
       








GWT-inTable.zip( 2 k)

Related examples in the same category

1.Use RootPanel to Load New Page