Java Reference
In-Depth Information
Ask the Expert
Q :
You have explained how to add a node to the scene graph. Is there a way to re-
move one?
A : Yes, to remove a control from the scene graph, call remove( ) on the Observ-
ableList . For example,
removes myLabel from the scene. In general, ObservableList supports a wide range of
list-management methods. Here are two examples. You can determine if the list is empty
by calling isEmpty( ) . You can obtain the number of nodes in the list by calling size( ) .
You will want to explore ObservableList on your own as you advance in your study of
JavaFX.
This program produces the following window:
In the program, pay special attention to this line:
It adds the label to the list of children for which rootNode is the parent. Although this line
could be separated into its individual pieces if necessary, you will often see it as shown
here.
Search WWH ::




Custom Search