File tree Expand file tree Collapse file tree 4 files changed +54
-2
lines changed
core-java-modules/core-java-swing
java/com/baeldung/controller Expand file tree Collapse file tree 4 files changed +54
-2
lines changed Original file line number Diff line number Diff line change 11<?xml version =" 1.0" encoding =" UTF-8" ?>
22<project xmlns =" http://maven.apache.org/POM/4.0.0"
3- xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
4- xsi : schemaLocation =" http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" >
3+ xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
4+ xsi : schemaLocation =" http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" >
55 <modelVersion >4.0.0</modelVersion >
66 <artifactId >core-java-swing</artifactId >
77 <packaging >jar</packaging >
Original file line number Diff line number Diff line change 1+ package com .baeldung .controller ;
2+
3+ import javafx .fxml .FXML ;
4+ import javafx .scene .control .Label ;
5+
6+ public class ControllerAnnotation {
7+ private final String appName ;
8+
9+ @ FXML
10+ private Label appNameLabel ;
11+
12+ public ControllerAnnotation (String name ) {
13+ this .appName = name ;
14+ }
15+
16+ @ FXML
17+ public void initialize () {
18+ this .appNameLabel .setText (this .appName );
19+ }
20+ }
Original file line number Diff line number Diff line change 1+ package com .baeldung .controller ;
2+
3+ import java .net .URL ;
4+ import java .util .ResourceBundle ;
5+
6+ import javafx .fxml .FXML ;
7+ import javafx .fxml .Initializable ;
8+ import javafx .scene .control .Label ;
9+
10+ public class ControllerInitializable implements Initializable {
11+ private final String appName ;
12+
13+ @ FXML
14+ private Label appNameLabel ;
15+
16+ public ControllerInitializable (String name ) {
17+ this .appName = name ;
18+ }
19+
20+ @ Override
21+ public void initialize (URL location , ResourceBundle res ) {
22+ this .appNameLabel .setText (this .appName );
23+ }
24+ }
Original file line number Diff line number Diff line change 1+ <?xml version =" 1.0" encoding =" UTF-8" ?>
2+
3+ <?import javafx .scene.control.Label?>
4+ <?import javafx .scene.layout.StackPane?>
5+
6+ <StackPane xmlns : fx =" http://javafx.com/fxml" fx : controller =" your.package.YourController" >
7+ <Label fx : id =" appNameLabel" text =" Example App" />
8+ </StackPane >
You can’t perform that action at this time.
0 commit comments