

package org.yournamehere.client;
import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.user.client.Command;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.MenuBar;
import com.google.gwt.user.client.ui.RootPanel;

public class MenuBarex implements EntryPoint{

 public void onModuleLoad() {
       Command cmd = new Command() {
      public void execute() {
        Window.alert("Menu item have been selected");
      }
    };
    MenuBar File = new MenuBar(true);
    File.addItem("New",cmd);
    File.addItem("Open",cmd);
    File.addItem("Close",cmd);

    MenuBar Edit = new MenuBar(true);
    Edit.addItem("Undo", cmd);
    Edit.addItem("Redo", cmd);
    Edit.addItem("Cut", cmd);
    Edit.addItem("Copy", cmd);

    MenuBar Format = new MenuBar(true);
    Format.addItem("Word wrap", cmd);
    Format.addItem("Font", cmd);
    
    MenuBar menu = new MenuBar();
    menu.addItem("File", File);
    menu.addItem("Edit", Edit);
    menu.addItem("Format", Format);

    RootPanel.get().add(menu);
  }
}