From 3f51adcbd002927303fb71029aa13a8b4ee3b57c Mon Sep 17 00:00:00 2001 From: giavaphi Date: Sun, 11 Dec 2022 16:04:28 +0100 Subject: [PATCH] show screenshots in tutorial --- .../zhaw/gartenverwaltung/TutorialController.java | 8 +++++--- .../{ => screenshots}/add-new-plant.png | Bin .../gartenverwaltung/{ => screenshots}/add-task.png | Bin .../{ => screenshots}/details-delete.png | Bin .../gartenverwaltung/{ => screenshots}/schedule.png | Bin .../{ => screenshots}/select-sow-harvest.png | Bin 6 files changed, 5 insertions(+), 3 deletions(-) rename src/main/resources/ch/zhaw/gartenverwaltung/{ => screenshots}/add-new-plant.png (100%) rename src/main/resources/ch/zhaw/gartenverwaltung/{ => screenshots}/add-task.png (100%) rename src/main/resources/ch/zhaw/gartenverwaltung/{ => screenshots}/details-delete.png (100%) rename src/main/resources/ch/zhaw/gartenverwaltung/{ => screenshots}/schedule.png (100%) rename src/main/resources/ch/zhaw/gartenverwaltung/{ => screenshots}/select-sow-harvest.png (100%) diff --git a/src/main/java/ch/zhaw/gartenverwaltung/TutorialController.java b/src/main/java/ch/zhaw/gartenverwaltung/TutorialController.java index 521a3bc..c540a79 100644 --- a/src/main/java/ch/zhaw/gartenverwaltung/TutorialController.java +++ b/src/main/java/ch/zhaw/gartenverwaltung/TutorialController.java @@ -1,6 +1,7 @@ package ch.zhaw.gartenverwaltung; +import ch.zhaw.gartenverwaltung.io.PlantList; import javafx.fxml.FXML; import javafx.scene.control.Button; import javafx.scene.image.Image; @@ -8,6 +9,7 @@ import javafx.scene.image.ImageView; import javafx.scene.layout.StackPane; import javafx.stage.Stage; import java.io.File; +import java.io.InputStream; /** * Controller class for the Tutorial.fxml file @@ -46,10 +48,10 @@ public class TutorialController { * @param fileName the file name of the source */ private void setImageView(ImageView imageView, String fileName) { - File file = new File(String.valueOf(PlantsController.class.getResource(fileName))); + InputStream is = PlantsController.class.getResourceAsStream("screenshots/" + fileName); Image image; - if (file.exists()) { - image = new Image(String.valueOf(PlantsController.class.getResource(fileName))); + if (is != null) { + image = new Image(String.valueOf(PlantsController.class.getResource("screenshots/" + fileName))); } else { image = new Image(String.valueOf(PlantsController.class.getResource("placeholder.png"))); } diff --git a/src/main/resources/ch/zhaw/gartenverwaltung/add-new-plant.png b/src/main/resources/ch/zhaw/gartenverwaltung/screenshots/add-new-plant.png similarity index 100% rename from src/main/resources/ch/zhaw/gartenverwaltung/add-new-plant.png rename to src/main/resources/ch/zhaw/gartenverwaltung/screenshots/add-new-plant.png diff --git a/src/main/resources/ch/zhaw/gartenverwaltung/add-task.png b/src/main/resources/ch/zhaw/gartenverwaltung/screenshots/add-task.png similarity index 100% rename from src/main/resources/ch/zhaw/gartenverwaltung/add-task.png rename to src/main/resources/ch/zhaw/gartenverwaltung/screenshots/add-task.png diff --git a/src/main/resources/ch/zhaw/gartenverwaltung/details-delete.png b/src/main/resources/ch/zhaw/gartenverwaltung/screenshots/details-delete.png similarity index 100% rename from src/main/resources/ch/zhaw/gartenverwaltung/details-delete.png rename to src/main/resources/ch/zhaw/gartenverwaltung/screenshots/details-delete.png diff --git a/src/main/resources/ch/zhaw/gartenverwaltung/schedule.png b/src/main/resources/ch/zhaw/gartenverwaltung/screenshots/schedule.png similarity index 100% rename from src/main/resources/ch/zhaw/gartenverwaltung/schedule.png rename to src/main/resources/ch/zhaw/gartenverwaltung/screenshots/schedule.png diff --git a/src/main/resources/ch/zhaw/gartenverwaltung/select-sow-harvest.png b/src/main/resources/ch/zhaw/gartenverwaltung/screenshots/select-sow-harvest.png similarity index 100% rename from src/main/resources/ch/zhaw/gartenverwaltung/select-sow-harvest.png rename to src/main/resources/ch/zhaw/gartenverwaltung/screenshots/select-sow-harvest.png