import javax.swing.*; import javax.swing.plaf.*; import javax.swing.plaf.nimbus.*; public class NimbusPropertiesDoNotImplUIResource { private static final String[] defPropertyKeys = new String[] { "Tree.leafIcon", "Tree.closedIcon", "Tree.openIcon", "Tree.selectionForeground", "Tree.textForeground", "Tree.selectionBackground", "Tree.textBackground", "Tree.selectionBorderColor"}; public static void main(String[] args) throws Exception { UIManager.setLookAndFeel(new NimbusLookAndFeel()); for (String propertyKey : defPropertyKeys) { verifyProperty(propertyKey); } } private static void verifyProperty(String propertyKey) { Object property = UIManager.get(propertyKey); if (property == null) { throw new NullPointerException(String.format("UIManager.get('%s') returned null.", propertyKey)); } if (!(property instanceof UIResource)) { throw new RuntimeException(String.format("Property '%s' is instance of '%s' instead of UIResource.", propertyKey, property.getClass())); } } }