• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

displaying java.awt.Image in a panel

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,
I am having trouble with displaying an Image object on my panel within an applet.
I manage to display the image only after I scroll between windows i.e. alt+tab away from my applet window and then alt-tab back. I then see the image displayed in the applet's panel, however when I move(or even click) my mouse the image disappears again and I have to alt-tab back and forth to see the image displayed again.
any suggestions ?
thanks,
Dave
 
Dave Sammut
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello again,
The problem seemed to be a cause of the JRE not refreshing my panel often enough. I extended the Panel object, created a setter method for my image and added my image to g.drawImage(myImage.... to the paint method of the extended Panel class.
I hope this helps someone out there.
Thanks,
dave
 
Bartender
Posts: 4121
IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In the setter method are you calling repaint()? This would repaint your panel with the new image when it gets set...
 
Dave Sammut
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
No, I am not calling repaint()in my setter method however, it still paints the most recent image in good time. I'll add repaint() to the setter to further imporve things.
thanks,
dave
 
reply
    Bookmark Topic Watch Topic
  • New Topic