I used applyTo(image)
on a AbstractImagePrototype
in the past. But now resources are mainly created with a @Resource AbstractImagePrototype
line.
The applyTo(Image) method provides an efficient way to replace the contents of an existing Image. This is useful in cases where an image changes its appearance based on a user's action. Instead of creating two Image objects then alternately hiding/showing them, one can use the applyTo(Image) method of two AbstractImagePrototype objects to transform a single Image object between two (or more) visual representations.
But now it seems better to use a ClientBundle
with @Source ImageResource
.
Unfortunately this ImageResource does not provide a applyTo(image)
method. What to I have to change to have the same functionality to just replace an image?
There's Image#setResource(ImageResource)
and AbstractImageResource.create(ImageResource)
, and many other ways to use an ImageResource
.