LWUIT本地化菜单栏 [英] LWUIT Localize MenuBar
本文介绍了LWUIT本地化菜单栏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想本地化LWUIT form
的MenuBar
.
I'd like to localize the MenuBar
of an LWUIT form
.
我不想向用户显示菜单"/选择"/取消".
I don't want to show the users "Menu" / "Select" / "Cancel".
我已经成功地本地化了单个命令,这些命令会在菜单打开时显示, 通过
I've successfully localized single commands, which get shown when the Menu opens, via
back.setCommandName("bk");
searchCommand.setCommandName("search");
exit.setCommandName("ex");
mainMenu.addCommand(back, 0);
mainMenu.addCommand(searchCommand, 1);
mainMenu.addCommand(exit, 2);
对于我尝试过的MenuBar
MenuBar m = NameOfMyForm.getMenuBar();
m.setName("test");
mainMenu.setMenuBar(m);
但这没用-这也无法让我访问选择"和取消".
But this didn't work - also this wouldn't give me access to "Select" and "Cancel".
推荐答案
使用setResourceBundle()
方法.请参阅代码以更改菜单,选择和取消命令标题.
Use setResourceBundle()
method. See the code for change the menu, select and cancel command captions.
Hashtable hashtable = new Hashtable();
hashtable.put("select", "your caption");
hashtable.put("cancel", "your caption");
hashtable.put("menu", "your caption");
UIManager.getInstance().setResourceBundle(hashtable);
假设您要对这些命令使用图片,则意味着使用setMenuIcons
方法,
Suppose if you want to use image for these commands means use setMenuIcons
method,
UIManager.getInstance().getLookAndFeel().setMenuIcons(Image select, Image cancel, Image menu)
这篇关于LWUIT本地化菜单栏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文