Last active
July 6, 2021 16:01
-
-
Save jiro4989/9e55bf86c944adf489d9cbbabc306d07 to your computer and use it in GitHub Desktop.
KotlinでJavaFXのListViewに独自データクラスを追加して、表示されるテキストを変更する方法
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// この例ではFileのデータを持つ | |
listView.cellFactory = Callback<ListView<File>, ListCell<File>> { | |
object : ListCell<File>() { | |
override fun updateItem(item: File?, empty: Boolean) { | |
super.updateItem(item, empty) | |
if (item != null) text = item.name | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment