You'll have to forgive me, as I left out some important details. Nevertheless, the problems you're seeing with this version aren't all my fault, so we'll share the blame this time, OK?
Here is a recipe for making the double-buffering work in a JApplet. I'm sorry I didn't tell you this before but I frankly just forgot that JApplet isn't actually a true Swing component itself!
1) Move the paintComponent() method into an inner class that extends JPanel. Just surround your existing paintComponent method, unchanged with
private class Painter extends JPanel {
and
}
2) Move the setBackground() line from init() to be the first line in paintComponent()
3) In init(), add this line near the beginning:
add(new Painter());
4) (Your part) you didn't actually change the class to extends JApplet; it still extends Applet. Make that change now.
5) The line
import javax.swing.JApplet.*;
is wrong and unnecessary; remove it.
I can't say the whole class will work OK, but the double-buffering will then work fine.