Say that the Graphics object grph has a drawing area of width=200 and height=150. Fill in the blanks so that a line is drawn from the lower left corner to the upper right corner of the area.

Answer:

grph.drawLine(  0, 149, 199, 0 )

Since the height is 150, and the numbering of pixels starts at zero, the Y coordinate of the lower left corner is 149.

End of the Chapter

You may wish to browse through the following. Click on a subject that interests you to go to where it was discussed.

The next chapter has more examples of applets and graphics.

You have reached the end of the chapter.

go to previous page   go to home page