Added loading FXML view
This commit is contained in:
parent
19dc3088fa
commit
9c52a48425
5
pom.xml
5
pom.xml
@ -15,6 +15,11 @@
|
|||||||
<artifactId>javafx-controls</artifactId>
|
<artifactId>javafx-controls</artifactId>
|
||||||
<version>17</version>
|
<version>17</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.openjfx</groupId>
|
||||||
|
<artifactId>javafx-fxml</artifactId>
|
||||||
|
<version>17</version>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
<build>
|
<build>
|
||||||
<plugins>
|
<plugins>
|
||||||
|
@ -1,9 +1,12 @@
|
|||||||
package net.metaunix;
|
package net.metaunix;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
import javafx.application.Application;
|
import javafx.application.Application;
|
||||||
|
import javafx.fxml.FXMLLoader;
|
||||||
|
import javafx.scene.Parent;
|
||||||
import javafx.scene.Scene;
|
import javafx.scene.Scene;
|
||||||
import javafx.scene.control.Label;
|
import javafx.scene.control.Label;
|
||||||
import javafx.scene.layout.StackPane;
|
|
||||||
import javafx.stage.Stage;
|
import javafx.stage.Stage;
|
||||||
|
|
||||||
|
|
||||||
@ -13,12 +16,15 @@ import javafx.stage.Stage;
|
|||||||
public class App extends Application {
|
public class App extends Application {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void start(Stage stage) {
|
public void start(Stage stage) throws IOException {
|
||||||
var javaVersion = SystemInfo.javaVersion();
|
var javaVersion = SystemInfo.javaVersion();
|
||||||
var javafxVersion = SystemInfo.javafxVersion();
|
var javafxVersion = SystemInfo.javafxVersion();
|
||||||
|
|
||||||
var label = new Label("Hello, JavaFX " + javafxVersion + ", running on Java " + javaVersion + ".");
|
var label = new Label("Hello, JavaFX " + javafxVersion + ", running on Java " + javaVersion + ".");
|
||||||
var scene = new Scene(new StackPane(label), 640, 480);
|
|
||||||
|
Parent root = FXMLLoader.load(getClass().getClassLoader().getResource("views/main.fxml"));
|
||||||
|
var scene = new Scene(root, 640, 480);
|
||||||
|
stage.setTitle("Acorn Music Player");
|
||||||
stage.setScene(scene);
|
stage.setScene(scene);
|
||||||
stage.show();
|
stage.show();
|
||||||
}
|
}
|
||||||
@ -27,4 +33,4 @@ public class App extends Application {
|
|||||||
launch();
|
launch();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user