File tree Expand file tree Collapse file tree 2 files changed +42
-0
lines changed
TeachingKidsProgramming/src
org/teachingkidsprogramming/section07events Expand file tree Collapse file tree 2 files changed +42
-0
lines changed Original file line number Diff line number Diff line change 1+ package org .teachingkidsprogramming .section07events ;
2+
3+ import org .teachingextensions .logo .MultiTurtlePanel ;
4+ import org .teachingextensions .logo .Turtle ;
5+ import org .teachingextensions .windows .MouseLeftClickListener ;
6+
7+ public class ManyAnimals implements MouseLeftClickListener
8+ {
9+ public ManyAnimals ()
10+ {
11+ showSomeTurtles ();
12+ }
13+ private void showSomeTurtles ()
14+ {
15+ MultiTurtlePanel mt = new MultiTurtlePanel ();
16+ Turtle t1 = new Turtle ();
17+ mt .addTurtle (t1 );
18+ t1 .setX (100 );
19+ t1 .setY (300 );
20+ Turtle t2 = new Turtle ();
21+ mt .addTurtle (t2 );
22+ t1 .setX (300 );
23+ t1 .setY (100 );
24+ mt .showPanel ();
25+ }
26+ @ Override
27+ public void onLeftMouseClick (int x , int y )
28+ {
29+ // createTurtles (recipe below) --#8
30+ //------------- Recipe for createTurtles --#8
31+ // Remove previous Tortoise from your program window --#9
32+ // programWindow.removePaintable();
33+ // Set the count of Turtles to a random number between 10 and 50 --#2.5
34+ // Create a tortoise at 200, 300 --#2.1
35+ // Add the circle to your program window --#2.4
36+ //------------- End of createTurtles recipe --#8
37+ }
38+ public static void main (String [] args )
39+ {
40+ new ManyAnimals ();
41+ }
42+ }
You can’t perform that action at this time.
0 commit comments