如何按需加载javafx.scene.image.Image? [英] How load javafx.scene.image.Image by demand?

查看:137
本文介绍了如何按需加载javafx.scene.image.Image?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以丢弃图片然后再加载它?是否可以按需加载?

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

我能否 ImageView 只在show上加载它的图像?

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

推荐答案

不, Image 合同中没有此类功能。图像可以在后台加载,但一旦加载,就无法卸载。

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

如果使用 ImageView ,那么你应该明确地将 Image 分配给它,但是JavaFX没有提供一种方法让您知道实际显示 ImageView 的时间。

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.

要实现所需的接近 ImageView ,我要分叉并高度利用已弃用的API Prism ,包括 NGImageView class。

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

这篇关于如何按需加载javafx.scene.image.Image?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆