package com.java2s.gwt.client;
import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.Command;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.Image;
import com.google.gwt.user.client.ui.MenuBar;
import com.google.gwt.user.client.ui.RootPanel;
public class GWTClient implements EntryPoint{
public void onModuleLoad() {
MenuBar menu = new MenuBar();
MenuBar menuCreate = new MenuBar(true);
MenuBar menuHelp = new MenuBar(true);
Constants constants = (Constants) GWT.create(Constants.class);
menuHelp.addItem(constants.AboutMenuItemName(), new DummyCommand());
menuCreate.addItem(constants.ClockMenuItemName(), new DummyCommand());
menuCreate.addItem(constants.CalculatorMenuItemName(), new DummyCommand());
menu.addItem(constants.HelpMenuName(), menuHelp);
menu.addItem(constants.CreateMenuName(), menuCreate);
menuCreate.addStyleName("submenu");
menuHelp.addStyleName("submenu");
RootPanel.get().add(menu);
}
}
public class DummyCommand implements Command{
public void execute() {
Window.alert("Menu Item Clicked");
}
}
package com.java2s.gwt.client;
public interface Constants extends com.google.gwt.i18n.client.Constants {
/**
* Translated "About".
*
* @return translated "About"
* @gwt.key AboutMenuItemName
*/
String AboutMenuItemName();
/**
* Translated "Create".
*
* @return translated "Create"
* @gwt.key CreateMenuName
*/
String CreateMenuName();
/**
* Translated "Help".
*
* @return translated "Help"
* @gwt.key HelpMenuName
*/
String HelpMenuName();
/**
* Translated "Calculator".
*
* @return translated "Calculator"
* @gwt.key CalculatorMenuItemName
*/
String CalculatorMenuItemName();
/**
* Translated "Clock".
*
* @return translated "Clock"
* @gwt.key ClockMenuItemName
*/
String ClockMenuItemName();
}
//////////////
HelpMenuName: Help
CreateMenuName: Create
AboutMenuItemName: About
CalculatorMenuItemName: Calculator
ClockMenuItemName: Clock
|