Traffic Light

This sample code shows you how to easily draw Shapes on the screen, and also to determine if a mouse click falls within a given Shape.

Download the following code, and get it to compile.

Files Needed

What You Should Do on Your Own

Assignments turned in without these things will receive no credit.

  1. Right now, there are three ellipses defined, but only two of them are drawn. Draw the third ellipse on the screen, in green.
  2. Add code so that a message is displayed when the yellow or green circles are clicked.



©2013 Graham Mitchell

This assignment is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 United States License.
Creative Commons License