children

open override val children: MutableObservableList<Node>

The base class Node has no children, so this is an empty list.

Many subclasses (e.g. HBox, VBox) expose children as a MutableObservableList, which means you can modify the children directly.

More complex subclasses, such as ToolBar and ScrollPane, children remains immutable and instead gives mutable access to a list of Nodes via items. This is because the items are not children, they are grandchildren, within a special container of some kind. The implementation of that container is not in the public API. The API lets you examine the children, but this isn't recommended, because later versions may change their structure, and your code might break.

Subclasses of Node which do have children, should override this, and listen to the ObservableList to ensure that the parent / child relationship is correctly maintained. See childrenListener.