Purchase Solution

HTML file to run program

Not what you're looking for?

Ask Custom Question

This applet program needs an html file to run. You should supply the file along with the program so that the reader can test it.

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

public class DrawRectangles extends Applet {

int width, height;

public void init() {
width = getSize().width;
height = getSize().height;
setBackground( Color.white );
}

public void paint( Graphics g ) {

//(back, blue, cyan, darkGray, gray, green, lightGray, magenta, orange, pink, red, white and yellow)
drawRectangle(g,Color.black,10,10);
drawRectangle(g,Color.blue,10,40);
drawRectangle(g,Color.cyan,10,70);
drawRectangle(g,Color.darkGray,10,100);
drawRectangle(g,Color.pink,10,130);
drawRectangle(g,Color.green,10,170);
drawRectangle(g,Color.lightGray,10,200);
drawRectangle(g,Color.magenta,10,230);
drawRectangle(g,Color.orange,10,260);
drawRectangle(g,Color.red,10,290);
drawRectangle(g,Color.white,10,320);
drawRectangle(g,Color.yellow,10,350);
drawRectangle(g,Color.gray,10,380);
}

public void drawRectangle(Graphics g,Color c,int x,int y)
{

g.setColor( c );
g.fillRect( x, y, 280, 280 );
}
}

Purchase this Solution

Solution Summary

The expert examines HTML files to fun programs.

Purchase this Solution


Free BrainMass Quizzes
Excel Introductory Quiz

This quiz tests your knowledge of basics of MS-Excel.

Basic UNIX commands

Use this quiz to check your knowledge of a few common UNIX commands. The quiz covers some of the most essential UNIX commands and their basic usage. If you can pass this quiz then you are clearly on your way to becoming an effective UNIX command line user.

Inserting and deleting in a linked list

This quiz tests your understanding of how to insert and delete elements in a linked list. Understanding of the use of linked lists, and the related performance aspects, is an important fundamental skill of computer science data structures.

Javscript Basics

Quiz on basics of javascript programming language.

Word 2010: Table of Contents

Ever wondered where a Table of Contents in a Word document comes from? Maybe you need a refresher on the topic? This quiz will remind you of the keywords and options used when working with a T.O.C. in Word 2010.