Turtle Chase

This code demonstrates API calls concerning Windows and Menus.

We need a separately opened window, TurtleFrame.java, which inherits from Frame. The applet Turtle.java creates and shows this window, and does nothing else.

A menu bar is created and put into the TurtleFrame window. Selecting item in the menu cause ActionEvents to be sent to listeners. TurtleFrame is registered as an ActionListener for all the MenuItems.

The help window TurtleHelpWindow.java is another window. The TurtleFrame keeps a reference to it so that it may kill it when it quits.

With some modification to this code, it would be possible to control the movement of the Turtle using the mouse. The TurtleFrame would register itself as a MouseListener, and code similar to our MouseClick applet would categorize the click and call moveMouse with the appropriate result of the categorization.