摆动 UIManager.getColor() 键 [英] Swing UIManager.getColor() keys

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

问题描述

是否有用于 Swing 的 UIManager.getColor() 键的列表?我似乎无法在网上找到它,只是偶尔引用诸如 "Panel.background""Table.selectionBackground" 之类的字符串.

Is there a list somewhere of the UIManager.getColor() keys for Swing? I can't seem to find it online, just occasional references to strings like "Panel.background" and "Table.selectionBackground".

推荐答案

我认为没有定义的标准键集.但是您可以尝试使用这段代码按字母顺序列出当前可用的代码:

I don't think there is a defined standard set of keys. But you could try this bit of code to list the ones currently available in alphabetical order:

List<String> colors = new ArrayList<String>();
for (Map.Entry<Object, Object> entry : UIManager.getDefaults().entrySet()) {
    if (entry.getValue() instanceof Color) {
        colors.add((String) entry.getKey()); // all the keys are strings
    }
}
Collections.sort(colors);
for (String name : colors)
    System.out.println(name);

这会产生一个太长的列表,无法在此处重现.

This produces a list too long to reproduce here.

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

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