0

我在这里得到 NPE:

Color base = UIManager.getColor("inactiveCaptionBorder");

尽管

UIManager.setLookAndFeel("com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel");

设置为应用程序。

任何信息都是可观的。

提前致谢。

4

2 回答 2

3

Nimbus DefaultsinactiveCaptionBorder中不存在值 for ,看起来SystemColor中的这个值没有直接应用于Nimbus Look and Fee l (我在 Nimbus 默认值中搜索值为 inactive 的字符串,发现只有两个值 == ,)inactiveCaptiontextInactiveText

@camickr的UIDefaults列表

于 2012-02-20T09:31:16.417 回答
0

顺便提一句。你应该这样设置你的 NimbusLookAndFeel:

for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
    if ("Nimbus".equals(info.getName())) {
        UIManager.setLookAndFeel(info.getClassName());
        break;
    }
}

对于所有不是 SUN JREs Java 1.7 的有 ajavax.swing.plaf.nimbus.NimbusLookAndFeel和 nocom.sun.java.swing.plaf.nimbus.NimbusLookAndFeel

于 2012-02-21T14:40:54.067 回答