48024 Lecture Notes - Lecture 9: Javafx, Scene Graph, Javabeans

53 views4 pages
5 Jun 2018
School
Department
Course
Professor
Study 9 Model View Controller
FXML
In GridPanes hgap sets the horizontal gap between child nodes and vgap sets the
vertical gap between child nodes.
A <Label> is used to label an input, whereas <Text> is used to display free-standing
text. The text of a <Label> can never change, whereas that of a <Text> can.
The <stylesheets> element is placed within the root node of the scene graph to link
to the URL of the CSS file.
You a assig a stle lass to a ode usig stleClass=z depedig o the
name of the style category in the CSS file.
Model-View-Controller
The MVC pattern splits a GUI program into 3 layers.
o Models are Java objects that represent the data of your application and the
operations on that data
o Views are the components that represent the graphical user interface of the
appliatio. Vies osere data i the odels Whe odel data hages,
the views are notified so they can update the screen.
o Controllers are the components that handle user interaction. Controllers
osere eets that occur in the views. When user interaction happens in
the view, the controllers are notified so they can handle the event.
Model
Contains data and related operations.
Does not contain user interface code:
o No Read Pattern
o No Menu Pattern
o No Output Pattern
Should provide getters and setters for the data
A pair of getter and setter methods is called a JavaBeans property. A read-only
propert is a getter ithout a setter. A Boolea propert getter uses the prefi is
istead of get
Properties enable a class to expose a public way of getting and setting values, while
hiding implementation code.
JavaFX properties are observable, which means every time they are changed, the
view is notified.
When creating new properties, one should use the SimplexxxxxxxProperty as it is an
implementation of the Observable, ReadOnlyxxxxxxProperty and the
xxxxxxxProperty.
find more resources at oneclass.com
find more resources at oneclass.com
Unlock document

This preview shows page 1 of the document.
Unlock all 4 pages and 3 million more documents.

Already have an account? Log in

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers

Related Documents