48024 Lecture Notes - Lecture 8: Observer Pattern, Graphical User Interface, Vbox Home Tv Gateway
Study 8 – GUIs
• Graphical user interface
Java FX
• A node is a graphical object
• A scene is a tree of nodes
• A stage is a place to display a scene (typically a window)
• An application is a class with the main method.
Scene Graph
• Each node in a scene is either a branch or a leaf
• A branch node can have children and split off into further leaves.
• A leaf node cannot.
• Packages to import:
• Leaf nodes are easy to reate y using the jaa lasses aailale, and the ne
keyword.
Branch nodes – VBox
• The constructor parameter is the number of pixel spacing wanted in the box in a
vertical array
Branch nodes – HBox
• The constructor parameter is the number of pixel spacing wanted in the box in a
horizontal array
Branch nodes – GridPane
• Lays out children in a grid of rows and columns
find more resources at oneclass.com
find more resources at oneclass.com
Document Summary
Study 8 guis: graphical user interface. Java fx: a node is a graphical object, a scene is a tree of nodes, a stage is a place to display a scene (typically a window, an application is a class with the main method. Branch nodes vbox: the constructor parameter is the number of pixel spacing wanted in the box in a vertical array. Branch nodes hbox: the constructor parameter is the number of pixel spacing wanted in the box in a horizontal array. Branch nodes gridpane: lays out children in a grid of rows and columns. Observer pattern: observers are notified whenever a subject changes. The pattern is implemented in two stages: phase 1: observers register with the subject, phase 2: when something happens to the subject, it notifies the observers. Inner classes: an inner class is a class defined within another class. It can access all members of the outer class.