对菜单进行编码,该菜单允许用户选择一种语言

编程入门 行业动态 更新时间:2024-10-24 10:25:00
本文介绍了对菜单进行编码,该菜单允许用户选择一种语言的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我将如何编码一个菜单,该菜单将允许用户选择一种语言,然后用户将使用自己选择的语言来呈现他的整个程序?

How would I go about coding a menu that will allow the user to select a language and thereafter the user will have his whole program rendered in the language of his choice?

注意:我正在使用Netbeans,建议使用自动内部化来制作bundle.properties文件的教程之一.

Note: I'm using Netbeans and one of the tutorials suggested using automatic internalization to make the bundle.properties files.

我不知道如何将语言设置为所选选项. 请详细解释,因为我几乎无法理解我现在在做什么.

What I don't know is how to set the language to selected option. Please explain in detail as I can barely understand what I'm doing right now.

int sel = cmbLang.getSelectedIndex(); switch (sel) { case 0: JOptionPane.showMessageDialog(null,"please make a selection"); break; case 1: fmt:setLocale(Locale.E);//set language to language 1 break; case 2: //set Language to language 2 break; }

推荐答案

根据建议此处您可以使用Locale.setDefault(Locale yourDesiredLocale)(请参见 Javadoc )更改语言.

As suggested here you could use Locale.setDefault(Locale yourDesiredLocale)(see Javadoc) to change the language.

更多推荐

对菜单进行编码,该菜单允许用户选择一种语言

本文发布于:2023-11-26 21:17:04,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1635223.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:菜单   语言   用户

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!