Fill I18N Message to MenuItem : I18N « GWT « Java

Home
Java
1.2D Graphics GUI
2.3D
3.Advanced Graphics
4.Ant
5.Apache Common
6.Chart
7.Class
8.Collections Data Structure
9.Data Type
10.Database SQL JDBC
11.Design Pattern
12.Development Class
13.EJB3
14.Email
15.Event
16.File Input Output
17.Game
18.Generics
19.GWT
20.Hibernate
21.I18N
22.J2EE
23.J2ME
24.JDK 6
25.JNDI LDAP
26.JPA
27.JSP
28.JSTL
29.Language Basics
30.Network Protocol
31.PDF RTF
32.Reflection
33.Regular Expressions
34.Scripting
35.Security
36.Servlets
37.Spring
38.Swing Components
39.Swing JFC
40.SWT JFace Eclipse
41.Threads
42.Tiny Application
43.Velocity
44.Web Services SOA
45.XML
Java Tutorial
Java Source Code / Java Documentation
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Java » GWT » I18NScreenshots 
Fill I18N Message to MenuItem

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 = (ConstantsGWT.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


           
       
GWT-I18N.zip( 3 k)
Related examples in the same category
1.I18N Message
2.Load String From Properties File
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.