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>
|
||||
<version>17</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.openjfx</groupId>
|
||||
<artifactId>javafx-fxml</artifactId>
|
||||
<version>17</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
<plugins>
|
||||
|
@ -1,9 +1,12 @@
|
||||
package net.metaunix;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import javafx.application.Application;
|
||||
import javafx.fxml.FXMLLoader;
|
||||
import javafx.scene.Parent;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.scene.control.Label;
|
||||
import javafx.scene.layout.StackPane;
|
||||
import javafx.stage.Stage;
|
||||
|
||||
|
||||
@ -13,12 +16,15 @@ import javafx.stage.Stage;
|
||||
public class App extends Application {
|
||||
|
||||
@Override
|
||||
public void start(Stage stage) {
|
||||
public void start(Stage stage) throws IOException {
|
||||
var javaVersion = SystemInfo.javaVersion();
|
||||
var javafxVersion = SystemInfo.javafxVersion();
|
||||
|
||||
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.show();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user