class CheckBoxTreeCellRenderer extends JPanel implements TreeCellRenderer {

  private final DefaultTreeCellRenderer renderer = new DefaultTreeCellRenderer();
  private final JCheckBox checkBox = new JCheckBox();
  
  private Component defaultComponent;

  CheckBoxTreeCellRenderer() {
    setLayout(new BorderLayout());
    setOpaque(false);
    checkBox.setOpaque(false);
    renderer.setLeafIcon(null);
    add(checkBox, BorderLayout.WEST);
  }

  @Override
  public Component getTreeCellRendererComponent(JTree tree, Object value, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus) {<FILL_FUNCTION_BODY>}
}

    Component component = renderer.getTreeCellRendererComponent(tree, value, selected, expanded, leaf, row, hasFocus);

    if (value instanceof CategoryNode) {
      if (defaultComponent != null) {
        remove(defaultComponent);
      }
      defaultComponent = component;
      add(component, BorderLayout.CENTER);
      CategoryNode node = (CategoryNode) value;
      checkBox.setSelected(node.isEnabled());
      return this;
    }

    if (value instanceof RuleNode) {
      if (defaultComponent != null) {
        remove(defaultComponent);
      }
      defaultComponent = component;
      add(component, BorderLayout.CENTER);
      RuleNode node = (RuleNode) value;
      checkBox.setSelected(node.isEnabled());
      return this;
    }

    return component;
  
<methods>public void <init>() ,public void <init>(java.awt.LayoutManager) ,public void <init>(boolean) ,public void <init>(java.awt.LayoutManager, boolean) ,public javax.accessibility.AccessibleContext getAccessibleContext() ,public javax.swing.plaf.PanelUI getUI() ,public java.lang.String getUIClassID() ,public void setUI(javax.swing.plaf.PanelUI) ,public void updateUI() <variables>private static final java.lang.String uiClassID