Multimedia - Java Programming Language - Lecture Slides, Slides of Computer Science

These are the Lecture Slides of Java Programming Language which includes Applet Class, Passing Parameters to Applets, Conversions, Applications and Applets, Running a Program, Applet, Application, Mouse Event, Keyboard Event etc. Key important points are: Multimedia, Audio Files, Playing Audio, Running Audio, Separate Thread, Displaying Images, Displaying a Sequence, Images, Using Mediatracker, Stored

Typology: Slides

2012/2013

Uploaded on 03/23/2013

dhruv
dhruv 🇮🇳

4.3

(12)

194 documents

1 / 11

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Chapter 14: Multimedia
Audio Files
Playing Audio
Running Audio on a Separate Thread
Displaying Images
Displaying a Sequence of Images
Using MediaTracker
Docsity.com
pf3
pf4
pf5
pf8
pf9
pfa

Partial preview of the text

Download Multimedia - Java Programming Language - Lecture Slides and more Slides Computer Science in PDF only on Docsity!

Chapter 14: Multimedia

• Audio Files

• Playing Audio

• Running Audio on a Separate Thread

• Displaying Images

• Displaying a Sequence of Images

• Using MediaTracker

Audio Files

  • Audio is stored in files. There are several

formats of audio files. JDK 1.2 can play

several audio file formats, including .wav

and .au files.

Using Audio Clips

  • public AudioClip getAudioClip(URL url);
  • public AudioClip getAudioClip(URL url, String name);

Either method creates an audio clip. Specify

String name to use a relative URL address.

  • public abstract void play()
  • public abstract void loop()
  • public abstract void stop()

Use these methods to start the clip, play it

repeatedly, and stop the clip, respectively.

Example 14.

Incorporating Sound in

Applets

  • Objective: Display a running clock and play

sound files to announce the time at every

minute.

ClockAppletWithAudio Run Applet Viewer

Displaying Images

Two methods are available for displaying

images:

Use the getImage() method to retrieve image files

and create Image objects.

Paint the images on the viewing area using the

drawImage() method.

Example 14.3: Displaying

Images in an Applet

  • Objective: Display images in applets

DisplayImageApplet

Run Applet Viewer

Example 14.5: Using Image

Animation

• Objective: Simulate a movie by

displaying a sequence of images in a

control loop.

ImageAnimation

Run Applet Viewer

Note: Images may take several seconds to load.

Example 14.6: Using

MediaTracker

  • Objective: Use the MediaTracker class to

load all the images before displaying them in

a sequence.

ImageAnimationUsingMediaTracker

Run Applet Viewer

Note: Images may take several seconds to load.