I have created a buffered image
Then I construct my GUI as a frame with three panels. The one on which the image is to be displayed is coded:
The image I'm working with is big, 4004 pixels by 2762 lines, and all that displays is the upper right hand corner. I want to scale it by a factor of 1/3 to fit on my display before displaying it.
I've looked at couple of APIs but I'm new at this and I'm missing something and I don't know how to use the hash table in this context.
It took a lot of searching and trials but I found a way by creating a class that extends JPanel and putting the code in it;
In my GUI setup:
It all appears to work now (at least to scale an image down) and I can retrieve the pixel values (16 bit gray scale) under the tool tip from the original data.
Joined: Feb 22, 2010
The above works but is not quite correct if one wants to print or save the image. I found the save image had the reduced size image in the upper right corner of the original image! Here's corrected code.