Previous    Next    Home    Source Code    Package

  1. The problem of smearing can be fixed by filling the applet with the background color before drawing the string. This is done by replacing the direct call to paint with a call to repaint(). Such a call is handled by the Java Virtual Machine and results in the applet being blanked (with the background color) followed by the call to this applet's paint method (thereby drawing the string).
  2. Observe the Graphics object passed to paint belongs to this applet in this case. This is not always the case, though.