Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

displaying java.awt.Image in a panel

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • 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
  • 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
  • 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
  • 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
 
You would be much easier to understand if you took that bucket off of your head. And that goes for the tiny ad too!
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic