All TODOS done

master
Oystein 2021-04-26 22:46:55 +02:00
parent c1c86a94c6
commit 4259d12d48
2 changed files with 14 additions and 5 deletions

View File

@ -4,6 +4,7 @@ import java.io.IOException;
import java.util.Optional;
import javafx.application.Application;
import javafx.application.Platform;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
@ -11,6 +12,7 @@ import javafx.scene.image.Image;
import javafx.stage.Stage;
import app.events.FileSaveStateChangedEvent;
import app.model.Model;
import app.service.DialogBoxes;
import app.settings.SettingsProvider;
public class Main extends Application {
@ -46,10 +48,15 @@ public class Main extends Application {
*
* @throws IOException
*/
private void loadFXML() throws IOException {
// TODO: Error handle this function.
this.fxmlLoader = new FXMLLoader(getClass().getResource("/fxml/Main.fxml"));
this.fxmlRoot = fxmlLoader.load();
private void loadFXML() {
try {
this.fxmlLoader = new FXMLLoader(getClass().getResource("/fxml/Main.fxml"));
this.fxmlRoot = fxmlLoader.load();
} catch (Exception e) {
DialogBoxes.showErrorMessage("There is an error within the program. Please try to reinstall.");
System.exit(1);
}
}
/**

View File

@ -93,7 +93,9 @@ public class MainController implements Initializable {
* @param cssPath The path in resources to the new CSS file
*/
private void setCSSAt(int position, String cssPath) {
// TODO: Error check that position in range 0 to 1
if ((position != 0) && (position != 1)) {
throw new IllegalArgumentException("Range of position must be either 0 or 1");
}
String nextStyleSheet = getClass().getResource(cssPath).toExternalForm();
Model.getScene().getStylesheets().set(position, nextStyleSheet);