HolidayCard() {
   tortoiseWindow = Tortoise.getBackgroundWindow();
   tortoiseWindow.addMouseListener(this);
   Tortoise.show();
   Tortoise.setSpeed(10);
   drawGreetingAndSing();
 }
 /**
  * Makes a cool shape fast <div><b>Example: </b> {@code tortoise.drawShape(6,PenColors.Reds.Red,
  * 50, 20)}</div>
  *
  * @param sides the number of sides
  * @param color a snazzy line color
  * @param length the bigger the better
  * @param width make a thick line - it's cool
  */
 public static void drawShape(int sides, Color color, int length, int width) {
   Tortoise.show();
   Tortoise.setSpeed(7);
   Tortoise.getBackgroundWindow().setBackground(PenColors.Yellows.Goldenrod);
   new Text("TKP Java - Make Some Shapes!")
       .setTopLeft(225, 50)
       .addTo(Tortoise.getBackgroundWindow());
   for (int i = 0; i < sides; i++) {
     Tortoise.setPenColor(color);
     Tortoise.setPenWidth(width);
     Tortoise.move(length);
     Tortoise.turn(360 / sides);
   }
   VirtualProctor.setClassName("Grace Hopper's Class");
   VirtualProctor.setName("Jean Bartik");
 }
 public static void drawTortoise() {
   Tortoise.show();
   Tortoise.setSpeed(9);
   Tortoise.getBackgroundWindow().setBackground(PenColors.Greens.DarkSeaGreen);
   new Text("TKP Java - It's the Tortoise!")
       .setTopLeft(200, 75)
       .addTo(Tortoise.getBackgroundWindow());
   Tortoise.setPenColor(PenColors.Greens.Green);
   Tortoise.setPenWidth(3);
   makeTortoiseBody();
   Tortoise.setPenColor(PenColors.Browns.Brown);
   Tortoise.turn(-65);
   Tortoise.makeTortoiseLeg();
   Tortoise.turn(90);
   Tortoise.move(150);
   Tortoise.turn(-90);
   Tortoise.makeTortoiseLeg();
 }
Ejemplo n.º 4
0
  private void go() {

    KeyboardFocusManager.getCurrentKeyboardFocusManager().addKeyEventDispatcher(this);

    Paintable backgroundImage = new ImageBackground("http://s30.postimg.org/oi69jth7l/fetch1.jpg");

    Tortoise.getBackgroundWindow().addPaintable(backgroundImage);

    Tortoise.penUp();
  }
 public static void main(String[] args) {
   Tortoise.show();
   Tortoise.getBackgroundWindow().setBackground(Grays.Black);
   Tortoise.setPenWidth(20);
   Tortoise.setSpeed(10);
   for (int i = 55; i < 999999999; i++) {
     Tortoise.setPenColor(PenColors.getRandomColor());
     length = length + 1;
     drawTriangle();
     Tortoise.turn(1000000000 / 20000);
   }
 }
 public static void main(String[] args) {
   Tortoise.setSpeed(10);
   Tortoise.getBackgroundWindow().setBackground(PenColors.Yellows.Goldenrod);
   int branchLength = 65;
   Tortoise.setX(175);
   Tortoise.setY(350);
   drawBranch(branchLength);
   drawBranch(branchLength - 1);
   Tortoise.setX(450);
   Tortoise.setY(350);
   drawBranch(branchLength);
   drawBranch(branchLength - 1);
 }
 //  Step 1: SELECT the method name (changeThePointerToAHand on line 27), then click the Run Button
 //            Keyboard shortcut to run ->  PC: Ctrl+F11 or Mac: Command+fn+F11
 //  Step 2: READ the name of the method that failed
 //  Step 3: FILL IN the blank (___) to make that method pass
 //  Step 4: SAY at least one thing you just learned
 //  Step 5: GO to the next method
 //  IMPORTANT - Do NOT change anything except the blank (___)//
 //
 @Test
 public void changeThePointerToAHand() throws Exception {
   Tortoise.getBackgroundWindow().___();
   Assert.assertEquals(getCursor(), Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
 }
 private Cursor getCursor() {
   return Tortoise.getBackgroundWindow().getCanvas().getCursor();
 }