Displaying changing graphics in Java

Some hints on how to display changing graphics in Java using a simple example I have borrowed from the following site:

http://www.dreamincode.net/forums/topic/30222-working-with-graphics-in-java/

I use the same approach to draw a number of concentric circles of differing sizes, but with a small delay in between each draw, refreshing the display at each iteration to give the illustration of the changing graphics.

Full Java code follows:

import java.awt.*;
import javax.swing.*;
 
public class MainApp extends JPanel 
{
    private static final long serialVersionUID = 1L;
    static JFrame frame = new JFrame("BullsEye");
    static int endpoint = 220;
    static int x, y;
     
    public static void main(String args[]) 
    {  
    	MainApp eye = new MainApp();
    	frame.add(eye);
        frame.setSize(300,300);
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
         
        for (x = 20; x <= 110; x += 10) 
        {
            endpoint = endpoint - 20;
            y = x + 10;          
            frame.setVisible(true);
                                             
            try
            {
                Thread.sleep(200);
                frame.revalidate();
                frame.repaint();           
            } 
            catch (InterruptedException e) 
            {
                e.printStackTrace();
            }
        }
    }
 
    // This method fires to draw our circles when we go to paint it on the frame
    public void paintComponent(Graphics g) { 
           super.paintComponent(g);
   
           g.setColor(Color.BLACK);
           g.drawOval(x,y,endpoint,endpoint);
    }
}

See video for quick demonstration: