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

前端 未结 3 1238
予麋鹿
予麋鹿 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:31

    It is best practice to have your images loaded before they are displayed!

    If you wish to get rid of the image simply set the image to null! But you will then have ro reinitialize that image in order to be able to view! I do not recommend this!

    If you will reuse that image just keep it memory! Load it once and use it on unlimited imageViews!

提交回复
热议问题