Skip to content
Snippets Groups Projects
Commit e1d31ce3 authored by Scherbaum Maximilian's avatar Scherbaum Maximilian
Browse files

created GameScene.fxml, created & implemented SceneLoader.java

parent d4d500c2
No related branches found
No related tags found
No related merge requests found
package de.hdm_stuttgart.battlearena.Controller;
import javafx.fxml.FXMLLoader;
import javafx.scene.layout.Pane;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import java.net.URL;
public class SceneLoader {
private static final Logger log = LogManager.getLogger(SceneLoader.class);
private Pane view;
//helper method for loading fxml files in the scene
public Pane loadScene(String fileName) {
try {
URL filePath = getClass().getResource("/fxml/" + fileName + ".fxml");
if (filePath == null) {
throw new java.io.FileNotFoundException(fileName + " not found");
}
new FXMLLoader();
view = FXMLLoader.load(filePath);
} catch (Exception e) {
log.debug("Scene " + fileName + " not found");
}
return view;
}
}
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.layout.AnchorPane?>
<AnchorPane prefHeight="400.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/19" xmlns:fx="http://javafx.com/fxml/1" fx:controller="de.hdm_stuttgart.battlearena.Controller.GameSceneController">
</AnchorPane>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment