![]() ![]() Alternatively, on the command line, you can use the command Now, to run the applet, simply open Checkerboard.html in a web browser. Place both of these class files in the same directory, together with Checkerboard.html and Checherboard.class. The result will be two class files, AnimationBase.class and AnimationBase$1.class. WRITE WATCHME APPLET CODEYou can find a copy on the Source Code page of the on-line version of this book. To do this, you should compile the source code, AnimationBase.java. Furthermore, since your program depends on the non-standard class Animation Base, you also have to make that class available to your program. Class, must be in the same directory with the Web-page file, Checkerboard.html. This is the source code for a simple Web page that shows nothing but your applet. Class Make a file that contains only the lines:Ĭall this file Checkerboard.html. Assume that your applet class is called Checkerboard, so that when you compile it you get a class file named Checkerboard. (To run an applet, you need a Web page to display it. Note that a square is just a rectangle in which the height is equal to the width, so you can use the subroutine g.fillRect() to draw the squares. Here is a tricky way to determine whether a given square should be red or black: If the row number and the column number are either both even or both odd, then the square is red. The checkerboard contains 8 rows of squares and 8 columns. Each square in the checkerboard is 20 by 20 pixels. Assume that the size of the applet is 160 by 160 pixels. ![]() Write your solution as a subclass of AnimationBase, even though all the frames that it draws will be the same. Write an applet that draws a checkerboard. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |