[107:7] extends: Control
The TreeView class wraps the JavaFX TreeView control, which displays hierarchical data as an expandable and collapsible tree. Each node in the tree is represented by a TreeItem, and the root TreeItem can optionally be hidden so the top-level children appear as the visual roots. TreeView supports single and multiple selection modes and fires selection-change events when the user clicks a different item. The tables below list every CSS property available to TreeView, organized by the class level where each property is defined.
| Property | Values | Default | Description |
|---|---|---|---|
-fx-fixed-cell-size |
<size> |
Region.USE_COMPUTED_SIZE |
Sets a fixed height for every cell. When set, -fx-fixed-cell-size takes precedence over -fx-cell-size. |
| Property | Values | Default | Description |
|---|---|---|---|
-fx-skin |
<string> |
null |
Fully qualified class name of the Skin to use for rendering this control. |
-fx-focus-traversable |
true | false |
true |
When true, the control participates in focus traversal via the keyboard Tab key. (Default is false for Accordion, ScrollPane.) |
| Property | Values | Default | Description |
|---|---|---|---|
-fx-background-color |
<paint> [, <paint>]* |
transparent |
One or more paint values for background fill layers, rendered back to front. |
-fx-background-insets |
<size> or <t> <r> <b> <l> [, ...]* |
0 0 0 0 |
Insets from the region edges for each background fill layer. |
-fx-background-radius |
<size> [/ <size>]* [, ...]* |
0 0 0 0 |
Corner radii for each background fill layer. |
| Property | Values | Default | Description |
|---|---|---|---|
-fx-background-image |
<uri> [, <uri>]* |
null |
One or more image URIs for background image layers. |
-fx-background-position |
<bg-position> [, ...]* |
0% 0% |
Position of each background image within the region. Accepts keywords or size values. |
-fx-background-repeat |
<repeat-style> [, ...]* |
repeat repeat |
Tiling behavior for each background image. Values: repeat, no-repeat, round, space applied per axis. |
-fx-background-size |
<bg-size> [, ...]* |
auto auto |
Dimensions for each background image. Supports cover, contain, stretch, or explicit sizes. |
| Property | Values | Default | Description |
|---|---|---|---|
-fx-border-color |
<paint> or <t> <r> <b> <l> [, ...]* |
null |
Paint colors for the border stroke layers. |
-fx-border-insets |
<size> or <t> <r> <b> <l> [, ...]* |
null |
Insets from region edges for each border layer. |
-fx-border-radius |
<size> [, ...]* |
null |
Corner radii for border stroke layers. |
-fx-border-style |
<border-style> [, ...]* |
null |
Border line style (solid, dotted, dashed) plus phase and line cap/join options per layer. |
-fx-border-width |
<size> or <t> <r> <b> <l> [, ...]* |
null |
Thickness of each border stroke layer, per side. |
| Property | Values | Default | Description |
|---|---|---|---|
-fx-border-image-source |
<uri> [, <uri>]* |
null |
Image URIs used to paint the border. |
-fx-border-image-insets |
<size> or <t> <r> <b> <l> [, ...]* |
0 0 0 0 |
Insets for each border image layer. |
-fx-border-image-repeat |
<repeat-style> [, ...]* |
repeat repeat |
Tiling behavior for each border image. |
-fx-border-image-slice |
<size> or <t> <r> <b> <l> [fill] [, ...]* |
100% |
Divides each border image into nine regions. Adding fill preserves the center region. |
-fx-border-image-width |
<size> or <t> <r> <b> <l> [, ...]* |
1 1 1 1 |
Width of each border image slice per side. |
| Property | Values | Default | Description |
|---|---|---|---|
-fx-padding |
<size> or <t> <r> <b> <l> |
0 0 0 0 |
Interior padding between the region border and its content. |
-fx-shape |
<string> |
null |
SVG path string that defines a custom clip shape for the region. |
-fx-scale-shape |
true | false |
true |
When true, the shape is scaled to fit the region. |
-fx-position-shape |
true | false |
true |
When true, the shape is centered within the region. |
-fx-snap-to-pixel |
true | false |
true |
When true, positions and sizes are rounded to whole pixel boundaries. |
-fx-min-width |
<size> |
-1 |
Minimum width. -1 uses the computed minimum. |
-fx-pref-width |
<size> |
-1 |
Preferred width. -1 uses the computed preferred. |
-fx-max-width |
<size> |
-1 |
Maximum width. -1 uses the computed maximum. |
-fx-min-height |
<size> |
-1 |
Minimum height. -1 uses the computed minimum. |
-fx-pref-height |
<size> |
-1 |
Preferred height. -1 uses the computed preferred. |
-fx-max-height |
<size> |
-1 |
Maximum height. -1 uses the computed maximum. |
| Property | Values | Default | Description |
|---|---|---|---|
-fx-blend-mode |
add | blue | color-burn | color-dodge | darken | difference | exclusion | green | hard-light | lighten | multiply | overlay | red | screen | soft-light | src-atop | src-in | src-out | src-over |
null |
Blend mode used when compositing this node with nodes beneath it. |
-fx-cursor |
null | crosshair | default | hand | move | e-resize | h-resize | ne-resize | nw-resize | n-resize | se-resize | sw-resize | s-resize | w-resize | v-resize | text | wait | <url> |
null (inherits) |
Mouse cursor shape shown when the pointer is over this node. Inherits from parent by default. |
-fx-effect |
<effect> |
null |
A visual effect (e.g. DropShadow, InnerShadow) applied to the rendered node. |
-fx-focus-traversable |
true | false |
false |
Whether this node participates in focus traversal. Overridden to true by Control. |
-fx-view-order |
<number> |
0 |
Adjusts rendering and hit-test order within the parent without changing the scene graph order. |
-fx-opacity |
<number> [0.0 - 1.0] |
1 |
Opacity of the node. 0 is fully transparent, 1 is fully opaque. |
-fx-rotate |
<number> |
0 |
Rotation angle in degrees applied around the node's center point. Positive values are clockwise. |
-fx-scale-x |
<number> |
1 |
Scale factor along the X axis about the node's center. |
-fx-scale-y |
<number> |
1 |
Scale factor along the Y axis about the node's center. |
-fx-scale-z |
<number> |
1 |
Scale factor along the Z axis about the node's center. |
-fx-translate-x |
<number> |
0 |
Translation offset along the X axis in pixels. |
-fx-translate-y |
<number> |
0 |
Translation offset along the Y axis in pixels. |
-fx-translate-z |
<number> |
0 |
Translation offset along the Z axis in pixels. |
visibility |
visible | hidden | collapse | inherit |
visible |
Controls whether the node is rendered and participates in layout. collapse removes it from layout; hidden keeps the space. |
-fx-managed |
true | false |
true |
When false, the parent layout does not manage this node's position or size. |
TreeView (object RootItem = null)
Creates a new TreeView with an optional root TreeItem.
RootItem is an optional TreeItem to use as the root.setRoot (object RootItem)
Sets the root TreeItem.
RootItem is a TreeItem to use as the root.this object for chainingsetShowRoot (bool Show)
Sets whether the root node is visible.
Show is a bool with true to show the root.this object for chaininggetSelected ()
Gets the currently selected TreeItem.
The selected TreeItem or null.getRoot ()
Returns the root TreeItem of the TreeView.
A TreeItem with the root node.getSelectedItem ()
Gets the currently selected TreeItem value.
The value held by the selected TreeItem, or null.onChange (callback OnChange)
Sets a callback for when the selection changes.
OnChange is a callback to call on selection change.this object for chainingsetPrefSize (double Width, double Height)
Sets the preferred width and height of the TreeView.
Width is a double with the preferred width in pixels.Height is a double with the preferred height in pixels.this object for chainingsetId (string Id)
Sets the CSS id of this TreeView node.
Id is a string with the CSS id.this object for chainingsetFixedCellSize (double Size)
Sets a fixed height in pixels for every row cell in the TreeView.
Size is a double with the fixed cell size, or -1 to use computed sizes.this object for chainingsetCellFactory (callback Factory)
Sets a custom cell factory callback that creates cells for each tree item.
Factory is a callback that receives a TreeView and returns a TreeCell.this object for chainingrootProperty ()
Returns the ObjectProperty backing the root TreeItem.
An AJO wrapping javafx.beans.property.ObjectProperty<TreeItemisShowRoot ()
Returns whether the root TreeItem is rendered.
A bool; true when the root is shown.showRootProperty ()
Returns the BooleanProperty backing the showRoot flag.
An AJO wrapping javafx.beans.property.BooleanProperty.setSelectionModel (object Model)
Replaces the selection model used by this TreeView.
Model is an AJO wrapping a javafx.scene.control.MultipleSelectionModel.this object for chaininggetSelectionModel ()
Returns the current selection model.
An AJO wrapping javafx.scene.control.MultipleSelectionModel<TreeItemselectionModelProperty ()
Returns the ObjectProperty backing the selection model.
An AJO wrapping javafx.beans.property.ObjectProperty<MultipleSelectionModel<TreeItemsetFocusModel (object Model)
Replaces the focus model used by this TreeView.
Model is an AJO wrapping a javafx.scene.control.FocusModel.this object for chaininggetFocusModel ()
Returns the current focus model.
An AJO wrapping javafx.scene.control.FocusModel<TreeItemfocusModelProperty ()
Returns the ObjectProperty backing the focus model.
An AJO wrapping javafx.beans.property.ObjectProperty<FocusModel<TreeItemexpandedItemCountProperty ()
Returns the read-only IntegerProperty backing the expanded item count.
An AJO wrapping javafx.beans.property.ReadOnlyIntegerProperty.getExpandedItemCount ()
Returns the number of currently expanded items in the TreeView.
An int with the visible item count.getFixedCellSize ()
Returns the fixed cell height in pixels, or a negative sentinel when unset.
A double with the fixed cell size.fixedCellSizeProperty ()
Returns the DoubleProperty backing the fixed cell size.
An AJO wrapping javafx.beans.property.DoubleProperty.setEditable (bool Editable)
Sets whether the TreeView allows inline editing of items.
Editable is a bool; true enables in-place editing.this object for chainingisEditable ()
Returns whether the TreeView allows inline editing.
A bool; true when editing is enabled.editableProperty ()
Returns the BooleanProperty backing the editable flag.
An AJO wrapping javafx.beans.property.BooleanProperty.getEditingItem ()
Returns the TreeItem currently being edited, or null when no edit is in progress.
An AJO wrapping the editing javafx.scene.control.TreeItem, or null.editingItemProperty ()
Returns the read-only ObjectProperty backing the editing item.
An AJO wrapping javafx.beans.property.ReadOnlyObjectProperty<TreeItemsetOnEditStart (callback OnStart)
Registers a callback for the editStart event.
OnStart is a callback invoked with a TreeView.EditEvent.this object for chaininggetOnEditStart ()
Returns the current onEditStart handler.
An AJO wrapping javafx.event.EventHandler<TreeView.EditEventonEditStartProperty ()
Returns the ObjectProperty backing the onEditStart handler.
An AJO wrapping javafx.beans.property.ObjectProperty<EventHandler<TreeView.EditEventsetOnEditCommit (callback OnCommit)
Registers a callback for the editCommit event.
OnCommit is a callback invoked with a TreeView.EditEvent.this object for chaininggetOnEditCommit ()
Returns the current onEditCommit handler.
An AJO wrapping javafx.event.EventHandler<TreeView.EditEventonEditCommitProperty ()
Returns the ObjectProperty backing the onEditCommit handler.
An AJO wrapping javafx.beans.property.ObjectProperty<EventHandler<TreeView.EditEventsetOnEditCancel (callback OnCancel)
Registers a callback for the editCancel event.
OnCancel is a callback invoked with a TreeView.EditEvent.this object for chaininggetOnEditCancel ()
Returns the current onEditCancel handler.
An AJO wrapping javafx.event.EventHandler<TreeView.EditEventonEditCancelProperty ()
Returns the ObjectProperty backing the onEditCancel handler.
An AJO wrapping javafx.beans.property.ObjectProperty<EventHandler<TreeView.EditEventedit (object Item)
Begins editing the given TreeItem when the TreeView is editable.
Item is a TreeItem to edit; pass null to cancel editing.this object for chainingscrollTo (int Index)
Scrolls the TreeView so the row at the given index is visible.
Index is an int with the zero-based row index.this object for chainingsetOnScrollTo (callback OnScroll)
Registers a callback for the scrollTo event.
OnScroll is a callback invoked with a TreeView.EditEvent-like ScrollToEvent.this object for chaininggetOnScrollTo ()
Returns the current onScrollTo handler.
An AJO wrapping javafx.event.EventHandler<ScrollToEventonScrollToProperty ()
Returns the ObjectProperty backing the onScrollTo handler.
An AJO wrapping javafx.beans.property.ObjectProperty<EventHandler<ScrollToEventgetRow (object Item)
Returns the row index of the given TreeItem within the tree, or -1 when the item is not present.
Item is a TreeItem to look up.An int with the row index, or -1.getTreeItem (int Index)
Returns the TreeItem displayed at the given row index, or null when the index is out of bounds.
Index is an int with the zero-based row index.An AJO wrapping the javafx.scene.control.TreeItem, or null.getTreeItemLevel (object Item)
Returns the depth (root-relative level) of the given TreeItem, or -1 when the item is not in the tree.
Item is a TreeItem whose level is reported.An int with the tree level.refresh ()
Forces the TreeView to rebuild its visible cells.
this object for chaininggetControlCssMetaData ()
Returns the list of CssMetaData entries declared on TreeView.
An AJO wrapping the List<CssMetaData extends Styleable, ?>>.queryAccessibleAttribute (string Attr)
Queries the value of a JavaFX AccessibleAttribute on this TreeView. Pass the enum constant name as a string (for example "ROLE", "TEXT").
Attr is a string with the javafx.scene.AccessibleAttribute enum name.The attribute value as returned by JavaFX.