] >
RGB is a coloring scheme based on mixing three colors: red (R), green (G), and blue (B). HTML allows to refer to such mixtures of colors through attributes of the following form, where i, j, and k represent integer numbers between 0 to 255.
style="color:rgb(i, j, k)"
Extend the Java program of Lab 2 so that the characters in the cells will be colored according to the following scheme.
Notes.
The following code fraction returns an integer value between 0 and 255.
(int) Math.round(Math.random()*255)
Example.
|
<html>
<head> <style type=’text/css’> td{ padding : 5pt; } table[rules], td { border : solid black 0.4pt; } </style> </head> <body> <table rules="groups"> <tr> <td style="color:rgb(0,127,127)">@</td> <td style="color:rgb(0,255,0)">A</td> </tr> <tr> <td style="color:rgb(0,0,255)">B</td> <td style="color:rgb(255,0,0)">C</td> </tr> </table> </body> </html> |
The characters A, B, and C receive random colors. The color of the character @ gets the average of the colors of the character at the end of row one and the character at the end of column one.
Suggestion. Build your program incrementally in the following manner.