Java Swing:所有UIDefaults属性的列表 [英] Java Swing: A list of all UIDefaults properties

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

问题描述

问题:在哪里可以获取Swing中存在的所有UIDefaults属性的列表?



我知道编写一小段代码的可能性,并显示它们,但是我想知道我这样做的列表是否真的完成。
当我这样做,我得到636属性为金属L& F,613为Windows L& F和550为Motif一。网上的另一个来源列出了795个条目,尽管它有一些不正确的附加条目。但是,即使金属l& f并不能全部实现。



我很难相信,真正不存在来自太阳的可能属性的官方列表

解决方案

并非所有属性都来自Sun。例如,Mac OS列出了特定于apple.laf.AquaLookAndFeel的654个属性+51。如果其他人想要提交结果,这里有一些代码:

  import javax.swing.UIDefaults; 
import javax.swing.UIManager;

public class CountUIDefaults {

public static void main(String [] args)throws Exception {
System.out.println(System.getProperty(os。名称)
++ System.getProperty(os.version)
++ System.getProperty(java.version));
UIManager.LookAndFeelInfo [] lfa =
UIManager.getInstalledLookAndFeels();
(UIManager.LookAndFeelInfo lf:lfa){
UIManager.setLookAndFeel(lf.getClassName());
UIDefaults uid = UIManager.getLookAndFeelDefaults();
System.out.println(***
++ lf.getName()
++ lf.getClassName()
++ uid .size()+entries);
}
}
}



 
Mac OS X 10.5.8 1.6.0_17
***金属javax.swing.plaf.metal.MetalLookAndFeel 636条目
*** Nimbus com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel 1052条目
*** CDE / Motif com.sun.java.swing.plaf.motif.MotifLookAndFeel 550条目
*** Mac OS X com.apple.laf.AquaLookAndFeel 705条目


Question: Where can I get a list of all UIDefaults properties that exist in Swing?

I know of the possibility to write a small snippet of code that just extracts and displays them but I would like to know whether the list I get that way is really complete. When I do so, I get 636 properties for the Metal L&F, 613 for Windows L&F and 550 for the Motif one. Another source on the net puts a list of 795 entries although it has some incorrect additional entries. But perhaps even the metal l&f does not set all it actually could.

I have difficulties to believe there really doesn't exist an official list of possible properties from sun.

解决方案

Not all properties come from Sun. For example, Mac OS lists 654 properties + 51 specific to apple.laf.AquaLookAndFeel. Here's some code if others want to submit results:

import javax.swing.UIDefaults;
import javax.swing.UIManager;

public class CountUIDefaults {

    public static void main(String[] args) throws Exception {
        System.out.println(System.getProperty("os.name")
            + " " + System.getProperty("os.version")
            + " " + System.getProperty("java.version"));
        UIManager.LookAndFeelInfo[] lfa =
            UIManager.getInstalledLookAndFeels();
        for (UIManager.LookAndFeelInfo lf : lfa) {
            UIManager.setLookAndFeel(lf.getClassName());
            UIDefaults uid = UIManager.getLookAndFeelDefaults();
            System.out.println("***"
                + " " + lf.getName()
                + " " + lf.getClassName()
                + " " + uid.size() + " entries");
        }
    }
}

Mac OS X 10.5.8 1.6.0_17
*** Metal javax.swing.plaf.metal.MetalLookAndFeel 636 entries
*** Nimbus com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel 1052 entries
*** CDE/Motif com.sun.java.swing.plaf.motif.MotifLookAndFeel 550 entries
*** Mac OS X com.apple.laf.AquaLookAndFeel 705 entries

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

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