4

Traffic Light

 2 years ago
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.
neoserver,ios ssh client
Traffic Light
  • 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.

  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


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK