Reworking NoPicturesLoadedException, fixing "about dialog"

dev
_N0x 3 years ago
parent ca64eca9b7
commit 7d2fd8d439

@ -5,7 +5,7 @@ package de.thm.tlf.photoViewer;
* but any of the actions that involve pictures are performed. * but any of the actions that involve pictures are performed.
*/ */
public class NoPicturesLoadedException extends Exception{ public class NoPicturesLoadedException extends Exception{
NoPicturesLoadedException(String s){ NoPicturesLoadedException(){
super(s); super("No pictures have been loaded");
} }
} }

@ -56,7 +56,7 @@ public class PVController extends Application {
private final Menu fileMenu = new Menu("File"); private final Menu fileMenu = new Menu("File");
private final Menu aboutMenu = new Menu("About"); private final Menu aboutMenu = new Menu("About");
private final MenuItem menuItemOpenFiles = new MenuItem("Open"); 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 menuItemStartSlideShow = new MenuItem("Start Slide Show");
private final MenuItem menuItemExitViewer = new Menu("Exit"); private final MenuItem menuItemExitViewer = new Menu("Exit");
private final MenuItem menuItemShowInfo = new Menu("Information"); private final MenuItem menuItemShowInfo = new Menu("Information");
@ -282,8 +282,6 @@ public class PVController extends Application {
bIsFullScreen ^= true; bIsFullScreen ^= true;
}); });
//slideShowBtn.setOnAction( });
// Starts the slideshow on first click, stops it on the next one // Starts the slideshow on first click, stops it on the next one
slideShowBtn.setOnAction(toggleSlidesHowEvent()); slideShowBtn.setOnAction(toggleSlidesHowEvent());
@ -315,7 +313,7 @@ public class PVController extends Application {
bSlideShowActive = false; bSlideShowActive = false;
// Change text of slideshow switches // Change text of slideshow switches
slideShowBtn.setText("Slide Show"); slideShowBtn.setText("Slide Show");
menuItemStartSlideShow.setText("Slide Show"); menuItemStartSlideShow.setText("Start Slide Show");
assert slideShowThread != null; assert slideShowThread != null;
slideShowThread.interrupt(); slideShowThread.interrupt();
} }
@ -380,11 +378,13 @@ public class PVController extends Application {
ButtonType btnType = new ButtonType("Ok", ButtonBar.ButtonData.OK_DONE); ButtonType btnType = new ButtonType("Ok", ButtonBar.ButtonData.OK_DONE);
aboutDialog.setContentText(""" aboutDialog.setContentText("""
Created by Tim Lukas Förster 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 //Adding buttons to the aboutDialog pane
aboutDialog.getDialogPane().getButtonTypes().add(btnType); aboutDialog.getDialogPane().getButtonTypes().add(btnType);
aboutDialog.show();
} }
/** /**

@ -69,7 +69,7 @@ public final class PictureHandler {
*/ */
public Picture getNextPicture() throws NoPicturesLoadedException { public Picture getNextPicture() throws NoPicturesLoadedException {
if(pictures.size() <= 0){ if(pictures.size() <= 0){
throw new NoPicturesLoadedException("No pictures have been loaded"); throw new NoPicturesLoadedException();
} }
else { else {
currentPictureID = (currentPictureID + 1) % pictures.size(); currentPictureID = (currentPictureID + 1) % pictures.size();
@ -85,7 +85,7 @@ public final class PictureHandler {
*/ */
public Picture getPrevPicture() throws NoPicturesLoadedException{ public Picture getPrevPicture() throws NoPicturesLoadedException{
if(pictures.size() <= 0){ if(pictures.size() <= 0){
throw new NoPicturesLoadedException("No pictures have been loaded"); throw new NoPicturesLoadedException();
} }
else { else {
currentPictureID = (currentPictureID + pictures.size() - 1) % pictures.size(); currentPictureID = (currentPictureID + pictures.size() - 1) % pictures.size();
@ -101,7 +101,7 @@ public final class PictureHandler {
*/ */
public Picture getPictureByID(int pictureID) throws NoPicturesLoadedException{ public Picture getPictureByID(int pictureID) throws NoPicturesLoadedException{
if(pictures.size() <= 0){ if(pictures.size() <= 0){
throw new NoPicturesLoadedException("No pictures have been loaded"); throw new NoPicturesLoadedException();
} }
else { else {
return pictures.get(pictureID); return pictures.get(pictureID);

Loading…
Cancel
Save