diff --git a/GifCreator/src/main/java/com/polarbirds/gifcreator/image_selection/ImageSelectionController.java b/GifCreator/src/main/java/com/polarbirds/gifcreator/image_selection/ImageSelectionController.java
index 0854597..ae3555f 100644
--- a/GifCreator/src/main/java/com/polarbirds/gifcreator/image_selection/ImageSelectionController.java
+++ b/GifCreator/src/main/java/com/polarbirds/gifcreator/image_selection/ImageSelectionController.java
@@ -74,8 +74,11 @@ public void initialize(URL location, ResourceBundle resources) {
leftList.setCellFactory(fileListView -> new FileNameCell());
- this.fileListChangeListener = change -> this.toggleGenerateButton();
- fm.getSelectedFilesList().addListener(fileListChangeListener);
+ this.fileListChangeListener = change -> {
+ btnGenerate.setDisable(change.getList().isEmpty());
+ };
+ fm.getSelectedFilesList().addListener(this.fileListChangeListener);
+ btnGenerate.setDisable(fm.getSelectedFilesList().isEmpty());
}
@Override
@@ -206,15 +209,6 @@ public void nextMode(Event e) {
//UTILITY
-
- public void toggleGenerateButton() {
- if (rightList.getItems().size() == 0) {
- btnGenerate.setDisable(true);
- } else {
- btnGenerate.setDisable(false);
- }
- }
-
/**
* Loads strings from resources
and saves it to private strings.
* If a value can't be loaded from resources
, the private string keeps the default value.