Class CheckRenderer

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible, TreeCellRenderer

public class CheckRenderer extends JPanel implements TreeCellRenderer
This class provides a custom renderer for a JTree that displays a check box before the standard open/closed subtree icon, and a text string for the node content. In the context of the TreeTable for the Likelihood detector, the top-level node that this cell renderer is used for does not display any node value information. The CheckRenderer intercepts mouse click events destined for the JTree, and if they are in the appropriate geometry, handles them as it could a check box. Otherwise, the events are forwarded to the JTree.
See Also:
  • Constructor Details

    • CheckRenderer

      public CheckRenderer(TreeModel model)
      Instantiates a new check renderer.
      Parameters:
      model - the model
  • Method Details

    • getTreeCellRendererComponent

      public Component getTreeCellRendererComponent(JTree tree, Object value, boolean isSelected, boolean isExpanded, boolean isLeaf, int row, boolean hasFocus)
      Specified by:
      getTreeCellRendererComponent in interface TreeCellRenderer
    • hasCheckBox

      public boolean hasCheckBox()
      Checks for check box.
      Returns:
      true, if successful
    • toggleCheckbox

      public void toggleCheckbox()
      Toggle checkbox.
    • getLabelText

      public String getLabelText()
      Gets the label text.
      Returns:
      the label text
    • pointWithinCheckBox

      public boolean pointWithinCheckBox(int x, int y, String nodeName)
      Point within check box.
      Parameters:
      x - the x
      y - the y
      nodeName - the node name
      Returns:
      true, if successful
    • getPreferredSize

      public Dimension getPreferredSize()
      Overrides:
      getPreferredSize in class JComponent
    • doLayout

      public void doLayout()
      Overrides:
      doLayout in class Container
    • setBackground

      public void setBackground(Color color)
      Overrides:
      setBackground in class JComponent