Take a look at the following code snippet.
Frame {
title: "Nodes (JavaFX demo)"
content: Canvas {
content: Nodes {}
}
visible: true
}
As you see from the code, JavaFX uses declarative syntax to specify GUI components so that the developer's code matches the actual layout of the GUI. You start building the GUI with a declaration of a Frame, then you set the frame's title, and add contents to the frame.
This code sample is from Using the Scene Graph to Present Visual Objects in JavaFX Script