I'm trying to create an applet of a rain storm. i've already have the program working, pretty much. the only problem that i have is... well let me explain it this way: RainDrop is the class that has the methods to draw the raindrop to the screen, move it down the screen, and destroy it when it reaches the bottom of the frame. (Note: if you want 20 raindrops on the screen, you need 20 instances of RainDrop by the way i have it setup.) each instance of RainDrop implements Runnable. the run methods of each class will paint a blue oval to the screen, move the coordinates down, then call repaint(). this paints to an image, ALL instances of raindrop paint to one image, then the call to paint well paints that image onto the frame, double buffering it. the problem i'm having is the stupid Thread system in java. here's an example of what i mean: 2 instances of raindrop are in the part of the thread sequence where it paints the raindrop to the screen. well, at the same time, another instance of raindrop is executing the command to draw a rectangle the size of the screen, to cover up the other traces of the left behinds raindrop images, making the raindrops look animated. what i'm basically getting at is that because of this system, the final result is that the raindrops flicker all the way down the screen, and i'm pretty sure that sun has created a class or a method that i have not seen yet that will take care of this problem. PLEASE HELP!!!
Joined: Feb 23, 2007
Hello and welcome to the Ranch!
You may want to post some code so we can see what you're doing. Also, is this Swing -- are you using a JApplet and drawing in a JPanel? Does each Raindrop call repaint? ... your code will likely answer most of our questions.