Explaining TopAnnouncementActive Objects

Active Objects

Active objects allow us to create animations by creating new threads along with the objects, so that the "event" thread can respond to mouse actions, while the "ActiveObject" continues to execute.

Recall that to create an ActiveObject one must:

  1. define a class that "extends ActiveObject"

  2. define its constructor and say "start()" at the end.

  3. define a "public void run()" method.

  4. Include a pause statement inside any while loops in the run method. This is necessary both to slow the animation and to allow the processor to take care of other pending tasks.

Explaining TopAnnouncementActive Objects