19. myadpage.java

/* Programmer: Chris H
   File:       myadpage.java
   Purpose:    play with drawing shapes in an html applet
   Version:    1
*/

import java.applet.*;
import java.awt.*;

public class myadpage extends Applet
{
public void paint(Graphics g)
{
//draw black background
g.setColor(Color.black);
g.fillRect(0,0,640,480);

int R = 120;
int G = 120;
int B = 120;

g.setColor(new Color(64,64,64));
for (int i = 0; i<14; i++)
{
for (int j=0; j<10; j++)
g.drawOval(i * 50,j*50,60,60);
}

for (int i = 10; i<50; i++)
{
g.setColor(new Color(R,G,B));
g.drawLine(0,0,i*20,600);
}

int xpos = 60;
int ypos = 80;
R = 0;
G = 0;
B = 50;
int width = 300;
int height = 100;
for (int i = 1; i<10; i++)
{
g.setColor(new Color(R,G,B));
g.fillRect(xpos,ypos,width,height);
xpos++;
ypos++;
height=height+i;
width=width+i;
R=R+5;
G=G+5;
B=B+(i*2);


}


g.setColor(Color.blue);
g.setFont(new Font("TimesRoman",Font.BOLD,36));
g.drawString("Murray Wayper",xpos + 10,ypos + 50);
g.setColor(Color.white);
g.drawString("Murray Wayper",xpos + 12,ypos + 52);
g.setColor(Color.red);
g.setFont(new Font("Helvetica",Font.ITALIC,24));
g.drawString("Phone:",xpos + 10, ypos + 80);
g.drawString("07-5555-5555",xpos + 100, ypos + 80);
g.setColor(Color.lightGray);
g.drawRoundRect(xpos+5,ypos+90,280,40,20,20);
g.setColor(Color.orange);
g.setFont(new Font("Courier",Font.PLAIN,18));
g.drawString("mwayper@powerup.com.au",xpos+15,ypos+115);

}

}