// generate a series of slightly shifted circles 	
	
import javax.swing.*;	
import java.awt.*;	
import ez.Sleep;	
	
public class Wiggler {	
	// main(): application entry point 	
	public static void main(String[] args) {	
		// define animation constants 	
		final Color BACKGROUND_COLOR = Color.WHITE;	
		final Color FOREGROUND_COLOR = Color.RED;	
		final int PAUSE_TIME = 10;	
		final int CIRCLE_DIAMETER = 10;	
	
		// set up display 	
		JFrame window = new JFrame("Wiggling");	
		window.setSize(200, 200);	
		window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);	
		window.setBackground(BACKGROUND_COLOR);	
		window.setVisible(true);	
		window.setBackground(BACKGROUND_COLOR);	
	
		// set up and draw first circle 	
		Graphics g = window.getGraphics();	
		g.setColor(FOREGROUND_COLOR);	
	
		int x = 0;	
		int y = window.getHeight()/2;	
	
		g.fillOval(x, y, CIRCLE_DIAMETER, CIRCLE_DIAMETER);	
			
		// set up generator for subsequent offsets 	
		Step step = new Step (0, 1, -1, 1);	
	
		// draw the shifted circles 	
		while (x < window.getWidth()) {	
			x += step.xShift();	
			y += step.yShift();	
			g.fillOval(x, y, CIRCLE_DIAMETER, CIRCLE_DIAMETER);	
			Sleep.pauseMilliseconds(PAUSE_TIME);	
		}	
	}	
}	
	
