I have an applet which draws strings in a scrolling fashion, and draws images. How can I minimise flickering? To display the moving text , I use Thread.sleep(). After each sleep interval, I draw the line[x] at (position-1), so that each line is moving up the applet. Can changing the sleep interval, or the position (ie. make it position - 2), eliminate flickering, or is there a better way of doing this? I can't use update(), because each time the screen must be painted fresh, or the text would overlap. Would appreciate a speedy response.
This should stop the flickering, but it may leave "artifacts" of what you were painting on the screen. You have to use double-buffering to overcome this problem. To find out how to use double-buffering, do a search in either this forum or the AWT/JFC/Swing forum for the word "double-buffering" or the words "double" and "buffering". I am sure you will find many posts on this topic that will show you exactly what to do.
Write once, run anywhere, because there's nowhere to hide! - /. A.C.