java.lang.Object
furbelow.CheckBoxTreeCellRenderer
- All Implemented Interfaces:
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.
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
static final int
static final int
static final int
-
Constructor Summary
ConstructorsConstructorDescriptionCheckBoxTreeCellRenderer
(JTree tree, TreeCellRenderer original) Create a per-tree instance of the checkbox renderer. -
Method Summary
Modifier and TypeMethodDescriptionprotected void
TreePath[]
Returns all checked paths.int[]
Returns all checked rows.protected TreePath
getPathForRow
(int row) protected int
protected Rectangle
getRowBounds
(int row) protected int
getRowForPath
(TreePath path) getTreeCellRendererComponent
(JTree tree, Object value, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus) protected void
boolean
Returns whether the given path is currently checked.boolean
isExplicitlyChecked
(TreePath path) boolean
isPartiallyChecked
(TreePath path) boolean
isSelectable
(TreePath path) Returns whether selecting the given path is allowed.static void
protected void
repaint()
protected void
void
toggleChecked
(int row)
-
Field Details
-
UNCHECKABLE
public static final int UNCHECKABLE- See Also:
-
FULLCHECKED
public static final int FULLCHECKED- See Also:
-
UNCHECKED
public static final int UNCHECKED- See Also:
-
PARTIALCHECKED
public static final int PARTIALCHECKED- See Also:
-
-
Constructor Details
-
CheckBoxTreeCellRenderer
Create a per-tree instance of the checkbox renderer.
-
-
Method Details
-
installMouseHandler
protected void installMouseHandler() -
addMouseHandler
-
getRow
-
getRowBounds
-
getPathForRow
-
getRowForPath
-
repaint
-
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 interfaceTreeCellRenderer
-
isExplicitlyChecked
-
isSelectable
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
Returns whether the given path is currently checked. -
isPartiallyChecked
-
toggleChecked
public void toggleChecked(int row) -
getCheckedRows
public int[] getCheckedRows()Returns all checked rows. -
getCheckedPaths
Returns all checked paths. -
main
-