What is an application and what is its life cycle?
Platform This is a static service class
that contains methods useful services for applications. Primarily
we will be using the method
Platform.exit() when we
wish to quit an application. This exits a program in a mannerly
System.exit() scrams and can cause
data loss for the user of your application.
Stage This is a top-level container
window. It functions like a
JFrame in the old Swing
library. Think of it as well ... a stage in which the GUI "actors"
Scene This tree data structure represents the
contents of a stage in a hierarchical structure called a scene
graph. All of your GUI widgets are stored in a scene.
Scenes can be shuffled in and out of a stage.
Within a scene, you will need to control layout. Here are some common layout tools.
Pane, a plain rectangular chunk of a window
BorderPane, window divided into five subregions: top, bottom, left, right and center. If you want menus in an app, you should use this and put them in the top sector. It looks like Swing's
HBox, a horizontal box
VBox, a vertical box
FlowPane, a "Jimmy Buffet" style layout that happily plops in widgets "texticographically" It looks like Swing's
GridPane, a layout that lays out widgets in a rectangular grid. It is more flexible than Swing's
Widgets JavaFX provides a wide variety of widgets. Here are some main ones.
Button, a widget that emits
MenuThis is the "head" of a menu.
MenuBarYou stick this in the top of a
BorderLayout. It is the home for your menus.
MenuItemThese are basically buttons.
TextFieldThis is a one-line text box. Hitting enter causes it to emit an
TextAreaThis is a two-dimensional text box.