I am confused about the results produced by the following program.
The program initializes the screen ( by calling drwinit()) and then draws on the screen (over the initialization). The Thread kicker is used in animation of the screen. The boolean initflag is a boolean flag for the initialization of the screen. The program, run as an application, works fine. As an applet it works fine only once out of 10 times. 90% of time, the applet (run in appletviewer) initializes the image on the screen ( the method drawinit() ), then ERASES the screen and draw on the empty screen. The other 10% of the time, the screen is not erased after the initialization. My questions are: 1. Why the program exhibits this inconsistent behaviour when run as an applet? 2. How can I change it such that it will not erase the screen after the mathod drawinit()?
[This message has been edited by Marilyn deQueiroz (edited September 06, 2001).]
It's highly questionable to make the paint() operation conditional. paint() gets called for a LOT of reasons. Any time that the GUI has reason to suspect that the client area has been corrupted - not just when data has changed. A lot of windowing systems can avoid calling paint() for simple operations like moving someone else's window over yours because they cache your image as a bitmap, but sooner or later, paint() WILL get called. Don't depend on the windowing system.
An IDE is no substitute for an Intelligent Developer.