From 7d2fd8d43937630a5fd7755be6821c61442bf028 Mon Sep 17 00:00:00 2001 From: _N0x Date: Tue, 16 Feb 2021 22:16:16 +0100 Subject: [PATCH] Reworking NoPicturesLoadedException, fixing "about dialog" --- .../tlf/photoViewer/NoPicturesLoadedException.java | 4 ++-- src/de/thm/tlf/photoViewer/PVController.java | 12 ++++++------ src/de/thm/tlf/photoViewer/PictureHandler.java | 6 +++--- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/de/thm/tlf/photoViewer/NoPicturesLoadedException.java b/src/de/thm/tlf/photoViewer/NoPicturesLoadedException.java index 99e6faa..9728da8 100644 --- a/src/de/thm/tlf/photoViewer/NoPicturesLoadedException.java +++ b/src/de/thm/tlf/photoViewer/NoPicturesLoadedException.java @@ -5,7 +5,7 @@ package de.thm.tlf.photoViewer; * but any of the actions that involve pictures are performed. */ public class NoPicturesLoadedException extends Exception{ - NoPicturesLoadedException(String s){ - super(s); + NoPicturesLoadedException(){ + super("No pictures have been loaded"); } } \ No newline at end of file diff --git a/src/de/thm/tlf/photoViewer/PVController.java b/src/de/thm/tlf/photoViewer/PVController.java index 8cdb359..9deb48f 100644 --- a/src/de/thm/tlf/photoViewer/PVController.java +++ b/src/de/thm/tlf/photoViewer/PVController.java @@ -56,7 +56,7 @@ public class PVController extends Application { private final Menu fileMenu = new Menu("File"); private final Menu aboutMenu = new Menu("About"); private final MenuItem menuItemOpenFiles = new MenuItem("Open"); - private final MenuItem menuItemClearViewer = new Menu("Close all"); + private final MenuItem menuItemClearViewer = new Menu("Close all pictures"); private final MenuItem menuItemStartSlideShow = new MenuItem("Start Slide Show"); private final MenuItem menuItemExitViewer = new Menu("Exit"); private final MenuItem menuItemShowInfo = new Menu("Information"); @@ -282,8 +282,6 @@ public class PVController extends Application { bIsFullScreen ^= true; }); - //slideShowBtn.setOnAction( }); - // Starts the slideshow on first click, stops it on the next one slideShowBtn.setOnAction(toggleSlidesHowEvent()); @@ -315,7 +313,7 @@ public class PVController extends Application { bSlideShowActive = false; // Change text of slideshow switches slideShowBtn.setText("Slide Show"); - menuItemStartSlideShow.setText("Slide Show"); + menuItemStartSlideShow.setText("Start Slide Show"); assert slideShowThread != null; slideShowThread.interrupt(); } @@ -380,11 +378,13 @@ public class PVController extends Application { ButtonType btnType = new ButtonType("Ok", ButtonBar.ButtonData.OK_DONE); aboutDialog.setContentText(""" Created by Tim Lukas Förster - Icons made by www.flaticon.com/authors/roundicons for www.flaticon.com"""); - + + Icons made by www.flaticon.com/authors/roundicons + for www.flaticon.com"""); //Adding buttons to the aboutDialog pane aboutDialog.getDialogPane().getButtonTypes().add(btnType); + aboutDialog.show(); } /** diff --git a/src/de/thm/tlf/photoViewer/PictureHandler.java b/src/de/thm/tlf/photoViewer/PictureHandler.java index 51bac9c..d710632 100644 --- a/src/de/thm/tlf/photoViewer/PictureHandler.java +++ b/src/de/thm/tlf/photoViewer/PictureHandler.java @@ -69,7 +69,7 @@ public final class PictureHandler { */ public Picture getNextPicture() throws NoPicturesLoadedException { if(pictures.size() <= 0){ - throw new NoPicturesLoadedException("No pictures have been loaded"); + throw new NoPicturesLoadedException(); } else { currentPictureID = (currentPictureID + 1) % pictures.size(); @@ -85,7 +85,7 @@ public final class PictureHandler { */ public Picture getPrevPicture() throws NoPicturesLoadedException{ if(pictures.size() <= 0){ - throw new NoPicturesLoadedException("No pictures have been loaded"); + throw new NoPicturesLoadedException(); } else { currentPictureID = (currentPictureID + pictures.size() - 1) % pictures.size(); @@ -101,7 +101,7 @@ public final class PictureHandler { */ public Picture getPictureByID(int pictureID) throws NoPicturesLoadedException{ if(pictures.size() <= 0){ - throw new NoPicturesLoadedException("No pictures have been loaded"); + throw new NoPicturesLoadedException(); } else { return pictures.get(pictureID);