Color (Object object) { if (object instanceof DefaultMutableTreeNode node) { object = node.getUserObject(); } if (object instanceof PresentableNodeDescriptor) { return ((PresentableNodeDescriptor<?>)object).getPresentation().getBackground(); } return null; }