Keep a copy of the game panel inside a buffered image. Then, every-time you want to change the frame, paint only the changes to the buffered image. Then all you have to do is over-ride the update method to not clear, and change the paint method to only paint that buffered image.
Note: You can do this without using a buffered image, but you will be left with some portions of the screen being updated before others since Java can draw one image a lot faster than trying to process and draw multiple sprites. This method also prevents long paint methods which will cause your game to run slower (may or may not be that big of a deal).
Something like this:
public class GamePanel extends JApplet
{
BufferedImage image;
public void update(Graphics g)
{
paint(g);
}
public void paint(Graphics g)
{
// draw the buffered image
g.drawImage(image, 0, 0, null);
}
// method that will update the animation sprites
public void updateImage()
{
// TODO: this is where you draw stuff to the buffered image
}
public void clearBuffer()
{
// clearing the buffered image is as simple as creating a new buffered image.
image = new BufferedImage(this.getWidth(), this.getHeight(), BufferedImage.TYPE_3BYTE_BGR);
}
}