How load javafx.scene.image.Image by demand?

前端 未结 3 1232
予麋鹿
予麋鹿 2021-01-29 06:04

Is it possible to discard loaded content of Image and later load it again? Is it possible to load it on demand?

Can I have ImageView which loads it\'s image only on show

3条回答
  •  一个人的身影
    2021-01-29 06:35

    No, there is no such functionality in Image contract. Image can load in background, but once loaded, it cannot be unloaded.

    If using ImageView, then you should assign Image to it explicitly, but JavaFX doesn't provide a way for you to know when ImageView is actually shown.

    To implement required close to ImageView, I was to fork it and highly utilize deprecated API with Prism, including NGImageView class.

提交回复
热议问题