CS 213 – Software Methodology
Copyright By PowCoder代写 加微信 powcoder
Lecture 17 – Nov 1
Calculator UI – Nested UI Structures
Building a Calculator – UI
CS 213 11/01/22
CS 213 11/01/22
Calculator UI – Nested UI Entities
CS 213 11/01/22
digits.fxml
(top-level)
Nested UI Entities – FXMLs
CS 213 11/01/22
fx:controller=”view.CalcController”>
Need this for URL tag used with CSS styling (see bottom)
You can nest UI entities with their own FXML
layouts, with fx:include
-fx-font-size: 18pt;
-fx-font-weight: bold;
.text-field {
-fx-font-size: 18pt;
Matching Nested Entities with Controllers
CS 213 11/01/22
The names of the controllers for the
contained UI FXMLs must match the
ids that go with fx:include in the
container’s FXML
IMPORTANT!!
source values are the ids declared
elsewhere in the FXML
needs
digits.fxml
This set up does away with the inefficiency of defining
one @FXML field per button in the controller class
CS 213 11/01/22
Matching ArrayList of fx:define to Java Code
digits.fxml
public class DigitController {
protected List
Container’s styling is inherited by contained UIs
-fx-font-size: 18pt;
-fx-font-weight: bold;
.text-field {
-fx-font-size: 18pt;
-fx-text-fill: blue;
digits.css
digits will be boldfaced and
have font size of 18 pt, as
defined in calc.css, plus
color blue as defined in digits.css
程序代写 CS代考 加微信: powcoder QQ: 1823890830 Email: powcoder@163.com