From 4528c771d4d66b288a895483af39a0790b66c2a4 Mon Sep 17 00:00:00 2001 From: osp1 Date: Mon, 27 Apr 2020 19:01:05 +0100 Subject: [PATCH] Fixed issues in Application, Dictionary, Practise - Fixed Application FXML Loader - Dictionary and Practise list now load --- .../src/main/java/module-info.java | 9 ++++++++- .../ac/aber/cs22120/group20/javafx/Application.java | 12 +++++++----- .../group20/javafx/PracticeListController.java | 4 ++-- .../uk/ac/aber/cs22120/group20/practicelist.fxml | 2 +- 4 files changed, 18 insertions(+), 9 deletions(-) diff --git a/src/Welsh Vocabulary Tutor/src/main/java/module-info.java b/src/Welsh Vocabulary Tutor/src/main/java/module-info.java index 5d44bb3..6375ab7 100644 --- a/src/Welsh Vocabulary Tutor/src/main/java/module-info.java +++ b/src/Welsh Vocabulary Tutor/src/main/java/module-info.java @@ -1,7 +1,14 @@ module uk.ac.aber.cs22120.group20 { requires javafx.controls; requires javafx.fxml; + requires com.fasterxml.jackson.core; + requires com.fasterxml.jackson.databind; + + opens uk.ac.aber.cs22120.group20.javafx to javafx.fxml; opens uk.ac.aber.cs22120.group20 to javafx.fxml; - exports uk.ac.aber.cs22120.group20; + opens uk.ac.aber.cs22120.group20.json to com.fasterxml.jackson.databind; + + exports uk.ac.aber.cs22120.group20.json to com.fasterxml.jackson.databind; + exports uk.ac.aber.cs22120.group20.javafx to javafx.graphics, javafx.fxml; } \ No newline at end of file diff --git a/src/Welsh Vocabulary Tutor/src/main/java/uk/ac/aber/cs22120/group20/javafx/Application.java b/src/Welsh Vocabulary Tutor/src/main/java/uk/ac/aber/cs22120/group20/javafx/Application.java index c718ed2..3bf61b9 100644 --- a/src/Welsh Vocabulary Tutor/src/main/java/uk/ac/aber/cs22120/group20/javafx/Application.java +++ b/src/Welsh Vocabulary Tutor/src/main/java/uk/ac/aber/cs22120/group20/javafx/Application.java @@ -16,20 +16,21 @@ import uk.ac.aber.cs22120.group20.json.JsonProcessing; import java.io.File; import java.io.IOException; +import java.net.URL; import java.util.LinkedList; import java.util.Scanner; /** * A class that launches the Welsh Vocabulary tutor Application. * + * @author Kain Bryan-Jones [kab74] * @author Brad Corbett [brc9] * @author Henry Dugmore [hjd3] - * @author Kain Bryan-Jones [kab74] - * @author Luke Wybar [law39] * @author Marcin Jakob [maj83] - * @author Oscar Pocock [osp1] * @author Tom Perry [top1] + * @author Oscar Pocock [osp1] * @author Waylen Watts [ncw] + * @author Luke Wybar [law39] * * @version 0.1 Initial development */ @@ -65,7 +66,7 @@ public class Application extends javafx.application.Application { // dictionary.add(new DictionaryEntry("disease", "clefyd", "nm", true)); // dictionary.add(new DictionaryEntry("extremely", "dros ben", "other", false)); // dictionary.add(new DictionaryEntry("flu", "ffliw", "nm", false)); - scene = new Scene(loadFXML("primary")); + scene = new Scene(loadFXML("dictionary")); stage.setScene(scene); // stage.setOnCloseRequest(e -> { // jsonProcessing.writeOutJson(jsonFileLocation, dictionary); @@ -91,7 +92,8 @@ public class Application extends javafx.application.Application { * @throws IOException */ private static Parent loadFXML(String fxml) throws IOException { - FXMLLoader fxmlLoader = new FXMLLoader(Application.class.getResource(fxml + ".fxml")); +// FXMLLoader fxmlLoader = new FXMLLoader(Application.class.getResource(fxml + ".fxml")); + FXMLLoader fxmlLoader = new FXMLLoader(new URL("file:src/main/resources/uk/ac/aber/cs22120/group20/" + fxml + ".fxml")); return fxmlLoader.load(); } diff --git a/src/Welsh Vocabulary Tutor/src/main/java/uk/ac/aber/cs22120/group20/javafx/PracticeListController.java b/src/Welsh Vocabulary Tutor/src/main/java/uk/ac/aber/cs22120/group20/javafx/PracticeListController.java index a52ed11..22e86a4 100644 --- a/src/Welsh Vocabulary Tutor/src/main/java/uk/ac/aber/cs22120/group20/javafx/PracticeListController.java +++ b/src/Welsh Vocabulary Tutor/src/main/java/uk/ac/aber/cs22120/group20/javafx/PracticeListController.java @@ -215,8 +215,8 @@ public class PracticeListController implements Initializable { * @throws IOException */ @FXML - private void switchToPrimary() throws IOException { - Application.setRoot("primary"); + private void switchToFlashCard() throws IOException { + Application.setRoot("flashcard"); } } diff --git a/src/Welsh Vocabulary Tutor/src/main/resources/uk/ac/aber/cs22120/group20/practicelist.fxml b/src/Welsh Vocabulary Tutor/src/main/resources/uk/ac/aber/cs22120/group20/practicelist.fxml index 74e37e3..c7d7cdf 100644 --- a/src/Welsh Vocabulary Tutor/src/main/resources/uk/ac/aber/cs22120/group20/practicelist.fxml +++ b/src/Welsh Vocabulary Tutor/src/main/resources/uk/ac/aber/cs22120/group20/practicelist.fxml @@ -72,7 +72,7 @@ -