Package furbelow

Class CheckBoxTreeCellRenderer

java.lang.Object
furbelow.CheckBoxTreeCellRenderer
All Implemented Interfaces:
TreeCellRenderer

public class CheckBoxTreeCellRenderer extends Object implements TreeCellRenderer
Provides checkbox-based selection of tree nodes. Override the protected methods to adapt this renderer's behavior to your local tree table flavor. No change listener notifications are provided.
  • Field Details

  • Constructor Details

    • CheckBoxTreeCellRenderer

      public CheckBoxTreeCellRenderer(JTree tree, TreeCellRenderer original)
      Create a per-tree instance of the checkbox renderer.
  • Method Details

    • installMouseHandler

      protected void installMouseHandler()
    • addMouseHandler

      protected void addMouseHandler(CheckBoxTreeCellRenderer.MouseHandler handler)
    • getRow

      protected int getRow(Point p)
    • getRowBounds

      protected Rectangle getRowBounds(int row)
    • getPathForRow

      protected TreePath getPathForRow(int row)
    • getRowForPath

      protected int getRowForPath(TreePath path)
    • repaint

      protected void repaint(Rectangle r)
    • repaint

      protected void repaint()
    • getTreeCellRendererComponent

      public Component getTreeCellRendererComponent(JTree tree, Object value, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus)
      Specified by:
      getTreeCellRendererComponent in interface TreeCellRenderer
    • isExplicitlyChecked

      public boolean isExplicitlyChecked(TreePath path)
    • isSelectable

      public boolean isSelectable(TreePath path)
      Returns whether selecting the given path is allowed. The default returns true. You should return false if the given path represents a placeholder for a node that has not yet loaded, or anything else that doesn't represent a normal, operable object in the tree.
    • isChecked

      public boolean isChecked(TreePath path)
      Returns whether the given path is currently checked.
    • isPartiallyChecked

      public boolean isPartiallyChecked(TreePath path)
    • toggleChecked

      public void toggleChecked(int row)
    • getCheckedRows

      public int[] getCheckedRows()
      Returns all checked rows.
    • getCheckedPaths

      public TreePath[] getCheckedPaths()
      Returns all checked paths.
    • main

      public static void main(String[] args)