I am trying to extends the AbstractImagePrototype as below:
public class DynamicImagePrototype extends AbstractImagePrototype { private String imagePath = null;
public DynamicImagePrototype (String imagePath) {
this.imagePath = imagePath;
}
@Override
public void applyTo(Image image)
{
}
@Override
public Image createImage() {
// TODO Auto-generated method stub
Image image = new Image(imagePath);
return image;
}
@Override
public String getHTML() {
return null;
}
}
I used it as below:
item = new Button() DynamicImagePrototype image = new DynamicImagePrototype("C:/temp/icons/reporting.gif"); item.setIcon(image);
However, it throw an exception.
My goal is that given an image file name, I want to return an AbstractImagePrototype so I can pass to Button.setIcon();
Thank you greatly for help!
So far, I have not found an answer for getting the AbstractImagePrototype dynamically yet. I have to use static deferred binding as below:
public interface ReefDesktopIconsShortcuts
extends ImageBundle
{
AbstractImagePrototype anImage();
}
In the directory where this interface resides, I have an image named "anImage.gif".
Cheers.