show screenshots in tutorial

This commit is contained in:
giavaphi 2022-12-11 16:04:28 +01:00
parent 4acd328286
commit 3f51adcbd0
6 changed files with 5 additions and 3 deletions

View File

@ -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")));
}

View File

Before

Width:  |  Height:  |  Size: 3.2 KiB

After

Width:  |  Height:  |  Size: 3.2 KiB

View File

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 16 KiB

View File

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

Before

Width:  |  Height:  |  Size: 42 KiB

After

Width:  |  Height:  |  Size: 42 KiB