Image that disappear (awt)

Hello, this is my first post (i’m a developer junior)

i have a problem with awt.
I have create an image on a Label with awt and with Pc Desktop i see it (the image) while on ipaq no.
The strange thing is that if i expand the window of my application on ipaq, the image appear!!!

I know that is a refresh problem but i don’t know how revolve the problem!!!

Can you help meee!!!

Try validate() on the parent.

I have try with validate on the parent and
with double buffering technique but nothin’ to do

???

How are you loading the image?

If you are using the old style image loading (not ImageIO) are you using an ImageTracker to make sure the image is laoded befoer you use it?

I simply call g.drawImage() with a label as ImageObserver

Can you help me about ImageTracker or another load method?!?!??!

Thanks very much

I have tried with this code but the problem remain

private Image image = null;
private MediaTracker imageTracker = null;

public LabelImage(Image image) {
this.image = image;
imageTracker = new MediaTracker(this);
imageTracker.addImage(image,0);
}

public void paint(Graphics g){
    try {
        imageTracker.waitForID(0);
    } catch (InterruptedException ex) {
        ex.printStackTrace();
    }
    
    g.drawImage(image,0,0,dimension.width,dimension.height,this);        
}

I dont see a repaint.

How is this class beign used? May I see the surrounding code?

there is no repaint or update!?!?

It is the problem?!?

Thanks so much Jeff!!

an example… (thanks, thanks, thanks… :wink: )

Well Im not sure how this class is beign used because I dsont see the surrounding code

BUT in general if you have an AWT or Swing component already on screen and you modify what it looks like, you need to call the repaint() method on that component in order to trigger AWT calling the paint() method again to re-draw it.

Thankssss sooo muchhh,
i have revolved, i call repaint on the component after the frame setVisible

;D