diff --git a/img-ui/src/main/kotlin/dev/nuculabs/imagetagger/ui/alerts/ErrorAlert.kt b/img-ui/src/main/kotlin/dev/nuculabs/imagetagger/ui/alerts/ErrorAlert.kt new file mode 100644 index 0000000..622aba3 --- /dev/null +++ b/img-ui/src/main/kotlin/dev/nuculabs/imagetagger/ui/alerts/ErrorAlert.kt @@ -0,0 +1,16 @@ +package dev.nuculabs.imagetagger.ui.alerts + +import javafx.scene.control.Alert +import javafx.scene.control.ButtonType +import javafx.scene.layout.Region + +class ErrorAlert(var message: String, var show: Boolean = true) : Alert(AlertType.ERROR) { + init { + contentText = message + dialogPane.buttonTypes.add(ButtonType.CLOSE) + dialogPane.minHeight = Region.USE_PREF_SIZE + if (show) { + show() + } + } +} \ No newline at end of file diff --git a/img-ui/src/main/kotlin/dev/nuculabs/imagetagger/ui/controls/ImageTagsEntryControl.kt b/img-ui/src/main/kotlin/dev/nuculabs/imagetagger/ui/controls/ImageTagsEntryControl.kt index d592993..b076536 100644 --- a/img-ui/src/main/kotlin/dev/nuculabs/imagetagger/ui/controls/ImageTagsEntryControl.kt +++ b/img-ui/src/main/kotlin/dev/nuculabs/imagetagger/ui/controls/ImageTagsEntryControl.kt @@ -1,17 +1,14 @@ package dev.nuculabs.imagetagger.ui.controls +import dev.nuculabs.imagetagger.ui.alerts.ErrorAlert import javafx.fxml.FXML import javafx.fxml.FXMLLoader -import javafx.scene.control.Alert -import javafx.scene.control.Alert.AlertType -import javafx.scene.control.ButtonType import javafx.scene.control.Label import javafx.scene.control.TextArea import javafx.scene.image.Image import javafx.scene.image.ImageView import javafx.scene.input.MouseEvent import javafx.scene.layout.HBox -import javafx.scene.layout.Region import java.awt.Desktop import java.io.File import java.io.IOException @@ -105,10 +102,7 @@ class ImageTagsEntryControl(private val imagePath: String, predictions: List