Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Double Buffering help!

 
Ryan Crichton
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, I'm new here and I need some help with an Applet that I'm writing. Its a very basic applet that I'm writing just to help myself learn more java. I'm having a problem with implementing Double Buffering. The applet just displays nothing at all, just a white screen, when I run it. Could some one plz have a look at the code and help me out. I'm sure there is something silly that I'm missing. Here's the source:



Also any general help will be appreciated as I'm sure my programming style needs work :roll: Also I haven't included any of the classes that this applet uses as I don't think that they are needed (If they are I'l post them)
Thanx in advance
 
Craig Wood
Ranch Hand
Pie
Posts: 1535
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
One possible problem is initializing offscreen in the init method. There may not be any size info or graphics context available unitl the Applet has been realized, ie, made visible. The size method is deprecated, see the method detail in the Component api.
Here are some suggestions/possibilities in uncompiled pseudo–code:
 
Ryan Crichton
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanx man, I'l try your suggestions as soon as I get Home (or get to a computer with Eclipse ) I'l let you know how it went as soon as I get to test it out.

Thanx for the quick responce.
 
Keith Lynn
Ranch Hand
Posts: 2409
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I normally put the initialization of the off screen image and off screen graphics in the init method, but you can use the getWidth() and getHeight() methods.

 
Ryan Crichton
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanx guys I got the buffer working now. Your help was much appreciated
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic