Java UIManager键列表 [英] Java UIManager key list

查看:98
本文介绍了Java UIManager键列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我见过人们使用UIManager来更改一些预先创建的swing组件的字符串(例如JFileChooser)。

I've seen people use UIManager to change strings of some pre-created swing components (e.g. JFileChooser).

我在哪里可以找到某种类型的引用告诉我哪些组件可以更改哪些字符串,以及如何访问它们?

Where can I find some kind of reference that will tell me which strings in which components are changeable, and how can I access them?

澄清:

我知道 UIManager.put(key,newString); 会将键引用的字符串文本更改为newString

I know that UIManager.put(key, newString); will change text of string that key references to, to "newString".

我在哪里可以找到密钥列表?

Where can I find the list of keys?

推荐答案

这些键由Swing PLAF资源包提供,您可以在JDK源中找到它们。参见eg:

These keys are provided by Swing PLAF resource bundles, and you can find them in the JDK sources. See e.g.:

  • http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/8u40-b25/com/sun/swing/internal/plaf/basic/resources/basic.java
  • http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/8u40-b25/com/sun/java/swing/plaf/windows/resources/windows.java
  • http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/8u40-b25/com/sun/java/swing/plaf/gtk/resources/gtk.java
  • ...

S研相邻捆绑文件提供非英语语言的ng值。

String values for languages other than English are provided by adjacent bundle files.

您只需为所需人员创建一个以上的文件,就可以向这些系列中的任何一个添加一个捆绑包语言并将其放在类路径的任何位置。 .java和.properties格式的捆绑包同样运行良好,但.java格式可能稍微更友好...

And you can add one more bundle to any of these families just by creating one more file for desired human language and placing it anywhere on your classpath. Bundles in .java and .properties format work equally well, though .java format may be slightly more Unicode-friendly...

尽管记住它可能会很好直接向 com.sun 包添加内容可能违反Java许可证。因此,为了安全起见,将您的额外资源移至您自己的软件包并使用 UIManager 注册它可能是明智之举:

It may be good to keep in mind though that direct adding of content to com.sun package may violate the Java license. So to be on the safe side, it may be wise to move your extra resources to a package of your own and register it with UIManager like this:

UIManager.getDefaults().addResourceBundle("mypackage.swing.plaf.basic.resources.basic");

这篇关于Java UIManager键列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆