Week 9: Menus, Images, and Audio

This week finishes our exploration of the AWT as you learn how to attach menu bars to frames and display bitmapped images in your Java programs.

Menus

Java lets you add menus to frames. (Menus cannot be added to dialogs.) This is probably overkill for an applet, but it's almost required for applications.

Images

Java images are bitmapped GIF or JPEG files that can contain pictures of just about anything. You can use any program at all to create them as long as that program can save in GIF or JPEG format. Once loaded into Java, images, whether GIF or JPEG, become instances of the abstract java.awt.Image class.

Audio

Java allows you to play audio files that are encoded in a particular format. Sound files must be 8-bit, mono, mu-law encoded, .au files. This is fairly restrictive and does not even cover all .au files.

Furthermore, Java only allows sound to be played by applets. The java classes do not currently provide a means for playing sounds in non-applets.

These restrictions are likely to be relaxed in the future through the Java Media Framework and API. However for now Java's audio support is quite limited.

Exercises


Start | Top
Last Modified November 17, 1997
Copyright 1997 Elliotte Rusty Harold
elharo@metalab.unc.edu