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

Double Buffering help!

 
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
 
Ranch Hand
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.
 
Ranch Hand
Posts: 2410
  • 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
 
You don't know me, but I've been looking all over the world for. Thanks to the help from this tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic