defaults.put("Tree[Enabled].expandedIconPainter", expandedIconPainter);
defaults.put("Tree:TreeCell[Focused+Selected].backgroundPainter", new SelectionBackgroundPainter(renderer.getBackgroundSelectionColor()));
TreeUI treeUI = getUI();
if (treeUI instanceof MetalTreeUI) {
BasicTreeUI basicUI = (BasicTreeUI) treeUI;
int size = 7;
BufferedImage expandedIcon = new BufferedImage(size, size, BufferedImage.TYPE_INT_ARGB);
expandedIconPainter.paint(expandedIcon.createGraphics(), null, size, size);
BufferedImage collapsedIcon = new BufferedImage(size, size, BufferedImage.TYPE_INT_ARGB);
collapsedIconPainter.paint(collapsedIcon.createGraphics(), null, size, size);
basicUI.setCollapsedIcon(new ImageIcon(collapsedIcon));
basicUI.setExpandedIcon(new ImageIcon(expandedIcon));
}
putClientProperty("Nimbus.Overrides", defaults);
putClientProperty("Nimbus.Overrides.InheritDefaults", true);
}