Netbeans java桌面应用程序:资源图国际化

时间:2010-07-21 20:54:54

标签: java netbeans

我正在尝试为我的应用程序引入国际化支持...我将其创建为netbeans java桌面应用程序。 Netbeans自动引入了以下代码:

public class ABC extends FrameView{
//constructor
public ABC(Singleframeapplication app)
{
//introduced by netbeans automatically
ResourceMap resourceMap=getResourceMap();
//

}


}

我如何使用此资源图对象为我的整个应用设置区域设置(例如FR)? PS:我在/ ABC / resources文件夹中创建了ABC_FR.properties 感谢

1 个答案:

答案 0 :(得分:0)

我通过在我的应用主要部分添加对Locale.setDefault()的调用来完成这项工作:

public static void main(String[] args) {
    System.out.println(Locale.getDefault()); // the JVM defaults to es_ES on my machine, so this prints "es_ES"
    Locale.setDefault(Locale.ENGLISH); // set it to English
    System.out.println(Locale.getDefault()); // Now it prints "en"
    launch(MyNiceApp.class, args); // my app comes up in English now
}

这里的记录相对较好:http://java.sun.com/developer/technicalArticles/J2SE/locale/

文档的问题在于它详细讨论了最复杂的案例,并且将整个应用程序放在特定语言中的最简单的情况下,这似乎是大多数程序员想要的。

相关问题