From ee432a0421cfe14c71089a86325f59e7bada40ee Mon Sep 17 00:00:00 2001 From: localhorst Date: Mon, 6 May 2019 00:19:38 +0200 Subject: [PATCH] added file chooser with extension filter --- .../view/importView/ImportViewController.kt | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/client/src/main/kotlin/org/hso/texturesyncclient/view/importView/ImportViewController.kt b/client/src/main/kotlin/org/hso/texturesyncclient/view/importView/ImportViewController.kt index 9af8792..8b7ce77 100644 --- a/client/src/main/kotlin/org/hso/texturesyncclient/view/importView/ImportViewController.kt +++ b/client/src/main/kotlin/org/hso/texturesyncclient/view/importView/ImportViewController.kt @@ -1,14 +1,22 @@ package org.hso.texturesyncclient.view.importView +import javafx.stage.FileChooser +import javafx.stage.FileChooser.ExtensionFilter import tornadofx.Controller +import tornadofx.FileChooserMode +import tornadofx.chooseFile class ImportViewController : Controller() { fun btnFileChooserAction() { println("btn click") - + var list = listOf("*.png", "*.PNG", "*.jpg", "*.JPG", "*.jpeg", "*.JPEG") + var filter = ExtensionFilter("Texturen vom Bildformat: PNG oder JPG", list) + val arrayFilter = arrayOf(filter) + var file = chooseFile("Textur auswählen", arrayFilter, FileChooserMode.Single, owner = null) + println(file) } } \ No newline at end of file