diff --git a/src/main/java/ch/zhaw/gartenverwaltung/MyScheduleController.java b/src/main/java/ch/zhaw/gartenverwaltung/MyScheduleController.java index 43eeb4c..df31cb9 100644 --- a/src/main/java/ch/zhaw/gartenverwaltung/MyScheduleController.java +++ b/src/main/java/ch/zhaw/gartenverwaltung/MyScheduleController.java @@ -24,6 +24,7 @@ import javafx.scene.layout.VBox; import java.io.IOException; import java.time.LocalDate; import java.util.List; +import java.util.Objects; import java.util.logging.Level; import java.util.logging.Logger; @@ -208,6 +209,12 @@ public class MyScheduleController { alert.setHeaderText("Are you sure you have completed this task?"); alert.setContentText("Confirming that you have completed the task will remove it from the schedule."); + DialogPane dialogPane = alert.getDialogPane(); + + dialogPane.getStylesheets().add( + Objects.requireNonNull(getClass().getResource("bootstrap/dialogStyle.css")).toExternalForm()); + dialogPane.getStyleClass().add("myDialog"); + alert.showAndWait() .ifPresent(buttonType -> { if (buttonType == ButtonType.OK) { diff --git a/src/main/java/ch/zhaw/gartenverwaltung/TutorialController.java b/src/main/java/ch/zhaw/gartenverwaltung/TutorialController.java index 2e0b1db..521a3bc 100644 --- a/src/main/java/ch/zhaw/gartenverwaltung/TutorialController.java +++ b/src/main/java/ch/zhaw/gartenverwaltung/TutorialController.java @@ -7,6 +7,7 @@ import javafx.scene.image.Image; import javafx.scene.image.ImageView; import javafx.scene.layout.StackPane; import javafx.stage.Stage; +import java.io.File; /** * Controller class for the Tutorial.fxml file @@ -32,17 +33,27 @@ public class TutorialController { switchViews(); setButtonAbilities(); - Image addNewPlantImage = new Image(String.valueOf(PlantsController.class.getResource("add-new-plant.png"))); - Image selectSowHarvestImage = new Image(String.valueOf(PlantsController.class.getResource("select-sow-harvest.png"))); - Image scheduleImage = new Image(String.valueOf(PlantsController.class.getResource("schedule.png"))); - Image detailDeleteButtonsImage = new Image(String.valueOf(PlantsController.class.getResource("details-delete.png"))); - Image addTaskImage = new Image(String.valueOf(PlantsController.class.getResource("add-task.png"))); + setImageView(imgAddNewPlant, "add-new-plant.png"); + setImageView(imgSelectDate, "select-sow-harvest.png"); + setImageView(imgDetailDeleteButtons, "details-delete.png"); + setImageView(imgTaskList, "schedule.png"); + setImageView(imgAddTaskButton, "add-task.png"); + } - imgAddNewPlant.setImage(addNewPlantImage); - imgSelectDate.setImage(selectSowHarvestImage); - imgDetailDeleteButtons.setImage(detailDeleteButtonsImage); - imgAddTaskButton.setImage(addTaskImage); - imgTaskList.setImage(scheduleImage); + /** + * update the given image view with screenshot or placeholder image. + * @param imageView the image view to update + * @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))); + Image image; + if (file.exists()) { + image = new Image(String.valueOf(PlantsController.class.getResource(fileName))); + } else { + image = new Image(String.valueOf(PlantsController.class.getResource("placeholder.png"))); + } + imageView.setImage(image); } public void viewNextPage() { diff --git a/src/main/resources/ch/zhaw/gartenverwaltung/Tutorial.fxml b/src/main/resources/ch/zhaw/gartenverwaltung/Tutorial.fxml index 93bb2d0..ae25ce8 100644 --- a/src/main/resources/ch/zhaw/gartenverwaltung/Tutorial.fxml +++ b/src/main/resources/ch/zhaw/gartenverwaltung/Tutorial.fxml @@ -14,7 +14,7 @@ - +