Jump to page content Jump to navigation

College Board

AP Central

AP Course Audit Web Site
Click for more information about College Board Online Events


Siemens Awards for Advanced Placement
Print Page
Home > AP Courses and Exams > Course Home Pages > Graphics with Sound and Animation

Graphics with Sound and Animation

by Brian Scarbeau
Lake Highland Preparatory School
Orlando, Florida

More Nifty Assignments...

Assignment
After learning how to create applets and use basic methods to draw and set color, students start to add methods to their applets.

The following is an example of some code for creating simple graphics:
  Project1.java.zip

The first method is to add sound to the applets. Students review the Trail: Sound Web site to find out how to do this.
  Trail: Sound

Student are also taught how to use the MouseListener.
  Project2.java.zip

To continue their study of methods and OOP (object-oriented programming), students learn how to create a GIF background in their applets, using the Animation with GIF Pictures, Sprite Animation applet.
  Animation with GIF Pictures, Sprite Animation

Finally, students learn how to animate the drawings that they created. The Animated Train code below shows a train moving left to right horizontally on the window. The movement does require some work because of the location of each drawing, but this program is well explained for anyone to copy and use. Make sure all sound files and graphic files are in the same directory of your project. My class has a contest, and we judge who has the best drawing, best background GIF, and best sound in the applets.
  train2.java.zip

Teacher's Comments
Students are intrigued with learning how to create graphics in Java. Although this material is not covered on the AP Exam, it still shows the importance of object-oriented programming.

Contribute
If you would like to contribute your suggestions for nifty assignments, please submit your ideas.


  MY AP CENTRAL
    Course and Email Newsletter Preferences
  AP COURSES AND EXAMS
    Course Home Pages
    Course Descriptions
    The Course Audit
    Sample Syllabi
    Teachers' Resources
    Exam Calendar and Fees
    Exam Questions
    AP Credit Policy Information
  PRE-AP
    Teachers' Corner
    Publications
  AP COMMUNITY
    About Electronic Discussion Groups
    Become an AP Exam Reader

Back to top