<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">// ****************************************************************
//   Colors.java
//
//   Draw rectangles to illustrate colors and their codes in Java
// ****************************************************************

import java.applet.Applet;
import java.awt.*;
import java.util.Random;

public class Colors extends Applet
{
    public void paint (Graphics page)
    {
	// Declare size constants
	final int PAGE_WIDTH = 600;
	final int PAGE_HEIGHT = 400;
	Random generator = new Random();

	// Declare variables
	int x, y;    // x and y coordinates of upper left-corner of each shape
	int width, height; // width and height of each shape
 
	Color myColor = new Color (200, 100, 255);


	// Set the background color and paint the screen with a white rectangle
	setBackground (Color.white);
	page.setColor(Color.white);
	page.fillRect(0, 0, PAGE_WIDTH, PAGE_HEIGHT);

	// Set the color for the rectangle
	page.setColor (myColor);

	// Assign the corner point and width and height then draw
	x = 200;
	y = 125;
	width = 200;
	height = 150;

	page.fillRect(x, y, width, height);
	
    }
}




</pre></body></html>