Basic HTML version of Foils prepared June 5 99

Foil 18 First Programming Lab - Patterns of Shapes

From Java Language in the Computer Science Curriculum ADMI Tutorial Duluth Minnesota -- June 3 99. by Geoffrey C. Fox


import java.applet.Applet;
import java.awt.*;
public class Pattern extends Applet
{ public void paint( Graphics g )
{
// The variable x represents where to draw in the x direction (to the right)
int x = 0;
// sets the background to be white and drawing color to be magenta
setBackground ( Color.white);
g.setColor( Color.magenta );
// draw a sequence of 6 circles of size 40, evenly spaced
for ( int i = 0; i < 6; i++ )
{ x = x + 50;
// each circle has y = 20, width and height = 40 pixels
g.fillOval ( x, 20, 40, 40 );
} } }



© Northeast Parallel Architectures Center, Syracuse University, npac@npac.syr.edu

If you have any comments about this server, send e-mail to webmaster@npac.syr.edu.

Page produced by wwwfoil on Sat Jun 5 1999