Component (final JTree tree, final Object value, final boolean selected, final boolean expanded, final boolean leaf, final int row, final boolean hasFocus) { final Component baseComponent = baseRenderer.getTreeCellRendererComponent(tree, value, selected, expanded, leaf, row, hasFocus); final Object userObject = ((DefaultMutableTreeNode)value).getUserObject(); if (!handler.isVisible(userObject)) { return baseComponent; } Color foreground = UIUtil.getTreeForeground(selected, hasFocus); Color background = UIUtil.getTreeBackground(selected, hasFocus); panel.add(baseComponent, BorderLayout.CENTER); panel.setBackground(background); panel.setForeground(foreground); CheckBoxState state = handler.getState(userObject); checkbox.setSelected(state != CheckBoxState.UNCHECKED); checkbox.setEnabled(state != CheckBoxState.PARTIAL); checkbox.setBackground(background); checkbox.setForeground(foreground); return panel; }