Click to See Complete Forum and Search --> : Resizing canvas in scrollpane


August 15th, 1999, 12:40 PM
I'm trying to load a different image into a scrollpane whenever the user clicks a button.
The images have different sizes.
How do I get my canvas to resize to the actual size of the image ?
The scrollbars on the scrollpane remains the same, so the larger image gets cropped to the size of the smaller image.
Thanks in advance for responding to this post.

olivierC
August 4th, 2000, 10:28 AM
I have a similar problem, i've tried to invalide and then validate the ScrollPane but it doesn't work.
If someone knows the answer it would be of GREAT help !!

hgjels
August 15th, 2000, 07:36 AM
I also have the same problem, to me it seems like the first image you load in to the scrollpane sets the size of it. So I have a very big Panel whit some text in it(where I explain how to use this program) as a first image, and after that I can load the smaler canvas.

Casanova
August 15th, 2000, 05:02 PM
ummm...have you tried getting the size of the actual image using

int width = image.getWidth(this);
int height = image.getHeight(this);

then using the handle of the canvas together with the command "resize". If you then call "validate" this should resize your canvas!

Casa