import java.awt.*;
import javax.swing.*;
public class DrawRectsLoop extends JApplet
{
int x=0;
int y=0;
int width=300;
int height=200;
int spacing = 20;
public void paint ( Graphics g )
{
while( width > spacing && height > spacing )
{
g.drawRect( x,y, width, height );
x = x + spacing;
y = y + spacing;
width = width - 2 * spacing;
height = height - 2 * spacing;
}
}
}