是否可以更改任何 Windows 桌面 属性 外观?

Is it possible to change any Windows Desktop Property Look and Feel?

在我工作的公司,我们从sun.awt.WToolkit派生了一个class,通过调用setDesktopProperty()来改变一些颜色。这多年来一直运作良好。但是现在在 JDK 8 中,WToolkit 是最终的,不能被子classed。简单的出路可能是做一些讨厌的反射并调用受保护的方法,但我不确定这不会产生安全异常或类似的东西。

正确的出路是通过Look and Feel来改变这些颜色。 Windows Desktop Property Support 中的 Oracle 声明

程序不需要直接访问这些属性; Windows 外观将自动读取和解释这些属性,为组件提供适当的视觉效果和行为。

但它没有说明任何有关通过 LaF 修改自定义这些属性的信息,当然 this doc 中提到的 UIManager.put("win.3d.shadowColor", Color.gray); 是无效的。

所以我的问题是,Windows 桌面属性是否可以通过子class现有的外观来更改,或者我应该求助于某种 hack 吗?

Swing 的 Windows Look&Feel 会将 Window 特定的桌面属性导入其默认值 table,但在此 table 中,标准的、独立于 LaF 的名称是used 通常由组件名称和 属性.

组成

例如:

try {
    UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch(ClassNotFoundException|InstantiationException
        |IllegalAccessException|UnsupportedLookAndFeelException ex) {
    Logger.getLogger(LaFColors.class.getName()).log(Level.SEVERE, null, ex);
    System.exit(1);
}
UIManager.put("Panel.background", Color.YELLOW);
UIManager.put("Button.foreground", Color.BLUE);
JFrame frame=new JFrame("Test");
frame.getContentPane().add(new JButton("See, it’s still "
   +UIManager.getLookAndFeel().getName()+" LaF"), BorderLayout.NORTH);
frame.setSize(200, 200);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setVisible(true);