简体   繁体   English

如何本地化jcolorchooser

[英]how to localise jcolorchooser

As part of a college project we are localising our application. 作为大学项目的一部分,我们正在本地化应用程序。

Is it possible to localise swing components such as JOptionPane and if so how? 是否可以定位JOptionPane之类的swing组件,如果可以的话,如何定位?

You can use ResourceBundle for localization in general (in option pane case for the choise strings and messages) . 通常,您可以使用ResourceBundle进行本地化(在选择窗格中选择字符串和消息)。 Then you can use those localized Strings etc for the JOptionPane. 然后,您可以将那些本地化的String等用于JOptionPane。 For example: 例如:

String[] choises = new String[];
choises[0] = bundle.getString("yes");
choises[1] = bundle.getString("no");
choises[2] = bundle.getString("cancel");

String message = bundle.getString("messageText")

JOptionPane optionPane = new JOptionPane(message, JOptionPane.WARNING_MESSAGE,
        JOptionPane.YES_NO_CANCEL_OPTION, null, choises);

For more details for resource bundles check out Java Internationalization: Localization with ResourceBundles . 有关资源包的更多详细信息,请查看Java国际化:使用ResourceBundles进行本地化

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM