I have a JFrame in which I need to have a TIFF image displayed and scaled. When a component gains focus I need to zoom in on a specific area of that image. For lack of a better method I simply created two PlanarImages, one scaled the appropriate size for the zoom out and one scaled to the size I would need when zoomed in and then converted those to BufferedImage. I use the BufferedImage in an ImageIcon which is in turn used in a JLabel which is in turn used in a JFrame. When I need to zoom in I get a Subimage of the BufferedImage that has the appropriate scaling and set that as ImageIcon's image.
It works... except for one thing... when I do the zoom in the image doesn't appear, well it will appear as soon as I change the size of the frame at all with my mouse. I'm not sure what I'm doing wrong, my code is getting called in the Event Handling
thread and should be thread safe, I don't know why it doesn't wait for it to load. I tried using a MediaTracker and waitForAll on the image but that doesn't help.