I'm trying to use a Canvas to display an animated gif. I have the animation working, but the canvas is too small to see the entire image, and I cannot get it to resize.
I can't even get it to be the right size for the first frame, so the animation/threading code is being omitted. My code looks like:
Composite comp = new Composite(parent, SWT.None);
comp.setLayout(new GridLayout(1, false));
final ImageLoader loader = new ImageLoader();
loader.load(getClass().getClassLoader().getResourceAsStream("MYFILE.gif"));
final Canvas canvas = new Canvas(comp, SWT.None);
final Image image = new Image(Display.getCurrent(), loader.data[0]);
canvas.addPaintListener(new PaintListener() {
public void paintControl(PaintEvent e) {
e.gc.drawImage(image, 0, 0);
}
});
The canvas area ends up being a tiny box of around 30x30, regardless of how big MYFILE.gif is. What the hell?
Anything I try to use to set the canvas size (setSize, setBounds, etc) does nothing.