Fixed issues in Application, Dictionary, Practise

- Fixed Application FXML Loader
- Dictionary and Practise list now load
This commit is contained in:
osp1 2020-04-27 19:01:05 +01:00
parent b37bc0b5e4
commit 4528c771d4
4 changed files with 18 additions and 9 deletions

View file

@ -1,7 +1,14 @@
module uk.ac.aber.cs22120.group20 { module uk.ac.aber.cs22120.group20 {
requires javafx.controls; requires javafx.controls;
requires javafx.fxml; 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; 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;
} }

View file

@ -16,20 +16,21 @@ import uk.ac.aber.cs22120.group20.json.JsonProcessing;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.net.URL;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.Scanner; import java.util.Scanner;
/** /**
* A class that launches the Welsh Vocabulary tutor Application. * A class that launches the Welsh Vocabulary tutor Application.
* *
* @author Kain Bryan-Jones [kab74]
* @author Brad Corbett [brc9] * @author Brad Corbett [brc9]
* @author Henry Dugmore [hjd3] * @author Henry Dugmore [hjd3]
* @author Kain Bryan-Jones [kab74]
* @author Luke Wybar [law39]
* @author Marcin Jakob [maj83] * @author Marcin Jakob [maj83]
* @author Oscar Pocock [osp1]
* @author Tom Perry [top1] * @author Tom Perry [top1]
* @author Oscar Pocock [osp1]
* @author Waylen Watts [ncw] * @author Waylen Watts [ncw]
* @author Luke Wybar [law39]
* *
* @version 0.1 Initial development * @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("disease", "clefyd", "nm", true));
// dictionary.add(new DictionaryEntry("extremely", "dros ben", "other", false)); // dictionary.add(new DictionaryEntry("extremely", "dros ben", "other", false));
// dictionary.add(new DictionaryEntry("flu", "ffliw", "nm", false)); // dictionary.add(new DictionaryEntry("flu", "ffliw", "nm", false));
scene = new Scene(loadFXML("primary")); scene = new Scene(loadFXML("dictionary"));
stage.setScene(scene); stage.setScene(scene);
// stage.setOnCloseRequest(e -> { // stage.setOnCloseRequest(e -> {
// jsonProcessing.writeOutJson(jsonFileLocation, dictionary); // jsonProcessing.writeOutJson(jsonFileLocation, dictionary);
@ -91,7 +92,8 @@ public class Application extends javafx.application.Application {
* @throws IOException * @throws IOException
*/ */
private static Parent loadFXML(String fxml) 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(); return fxmlLoader.load();
} }

View file

@ -215,8 +215,8 @@ public class PracticeListController implements Initializable {
* @throws IOException * @throws IOException
*/ */
@FXML @FXML
private void switchToPrimary() throws IOException { private void switchToFlashCard() throws IOException {
Application.setRoot("primary"); Application.setRoot("flashcard");
} }
} }

View file

@ -72,7 +72,7 @@
<TableView fx:constant="CONSTRAINED_RESIZE_POLICY" /> <TableView fx:constant="CONSTRAINED_RESIZE_POLICY" />
</columnResizePolicy> </columnResizePolicy>
</TableView> </TableView>
<Button fx:id="primaryButton" onAction="#switchToPrimary" text="Switch to Primary View" /> <Button fx:id="primaryButton" onAction="#switchToFlashCard" text="Switch to FlashCard View" />
</children> </children>
<padding> <padding>
<Insets bottom="20.0" left="20.0" right="20.0" top="20.0" /> <Insets bottom="20.0" left="20.0" right="20.0" top="20.0" />