I've create a class that extends Image and has in it a private BufferedImage object that it draws on and defers to it for any method calls. For example:
What i draw on the buffered image is a bunch of images that I load and lay out on the buffered image in a specific design. I've checked the following and they all check out as correct:
1. the buffered image width,height 2. every image is painted within the bufferedimage's width/height (for x,y) 3. every image does exist
For some reason, however, when i try to pass the image to a JLabel, via new ImageIcon( new MyImageClass() ), and add that to a JFrame's content pane, it always comes as an empty JFrame. It does get sized properly, however.
In checking which "Image" methods are called, only two are ever called (from what i can tell):
public int getWidth(ImageObserver o) public int getHeight(ImageObserver o)
Why is that? It seems to me that to draw an image, a component would need to grab it's pixel data somehow. Any idea why it never calls any other methods? (BTW, when it does call those methods, it prints out the correct 160, 179 values).
More Info * the images are all "png" images with some transparency * I create the BufferedImage as: BufferedImage b = new BufferedImage( w, h, BufferedImage.TYP_INT_RGB ); [ October 01, 2006: Message edited by: Dan Bizman ]