Traffic Light
source link: http://programmingbydoing.com/a/gfx-trafficlight.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
- Author: Graham Mitchell
- Filename: TrafficLight.java
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.
- Right now, there are three ellipses defined, but only two of them are drawn. Draw the third ellipse on the screen, in green.
- 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.
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK