Applet initial painting - content overlap?

I have 4 small applets on a page that simply prints out the quadratic equation for values passed in. There are 4 applets on a page that have different values assigned. They display fine.... sometimes.... if I refresh or generate new numbers sometimes one applet looks as though it has numbers overlapping the new values. If I resize or drag the browser everything displays fine again - no need to refresh the browser or anything. It's as though old values or something are being overwritten by the new or something similar is happening. What should I include in the paint method of the JPanel that might help clear the applet before initial painting happens..... if anything? Thanks.

First of all you shouldn't be overriding the paint() method, you should be overriding the paintComponent() method instead. This won't solve your current problem but it is the correct way to paint on swing components and it may well prevent other problems arising so rename your paint() method to the paintComponent().

If your panel is not being cleared properly starting the paintComponent() method with super.paintComponent() may well solve your problem.