de.fhg.igd.ui
Class Multimedia

java.lang.Object
  extended byde.fhg.igd.ui.Multimedia

public class Multimedia
extends Object

This class provides easy access to animations and sounds. Both animations and sounds are cached for more efficient memory usage and improved setup time. Media items can be prefetched or fetched on demand (the first time they are requested).

A mapping file can be specified that maps alias names onto actual path names (of the media items that are loaded). The format of this file is that of a simple Java Properties file.

When prefetching media items (using the -cache option), the media type must be specified:

img
Image file such as a GIF or JPEG
audio
Audio files such as AU or SND files
anim
Animation definitions as defined by class AnimatedIcon
The arguments to option -cache are a space separated list of media items where the prefix is the media type followed by a colon as the separator. After the colon, the path must be given. The path may be mapped to another path, if the given path is defined as an alias in the mapping file. The resulting path must identify the media item relative to some element in the class path.

Version:
"$Id: Multimedia.java 1913 2007-08-08 02:41:53Z jpeters $"#
Author:
Volker Roth

Field Summary
private static Map animations_
          The cache of animations.
private static Set cache_
          The multimedia items that are prefetched and cached permanently.
static String DEFAULT_MAP
          The name of the default mapping file.
static String DESCR
          The command line parameter definitions of this class.
private static Map images_
          The cache of images.
private static Properties props_
          The properties that are used to resolve aliases of media items to resource names.
private static Map sounds_
          The cache of sounds.
protected static String UNAVAILABLE
          A placeholder for unavailable media.
 
Constructor Summary
Multimedia()
           
 
Method Summary
static AnimatedIcon getAnimatedIcon(String name)
           
private static AnimatedIcon getAnimatedIcon0(String name)
           
static Image getImage(String name)
           
private static AudioClip getSound(String name)
           
static void main(String[] argv)
           
static void playSound(String name)
           
private static String resolve(String name)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_MAP

public static final String DEFAULT_MAP
The name of the default mapping file. The mapping file maps media names to actual path names. This mechanism can be used to let classes define names of media items they wish to use based on their package name, yet keep the media items in a different path (and allow many to one mappings).

See Also:
Constant Field Values

DESCR

public static final String DESCR
The command line parameter definitions of this class.

See Also:
Constant Field Values

UNAVAILABLE

protected static final String UNAVAILABLE
A placeholder for unavailable media.

See Also:
Constant Field Values

cache_

private static volatile Set cache_
The multimedia items that are prefetched and cached permanently.


props_

private static Properties props_
The properties that are used to resolve aliases of media items to resource names.


sounds_

private static Map sounds_
The cache of sounds.


animations_

private static Map animations_
The cache of animations.


images_

private static Map images_
The cache of images.

Constructor Detail

Multimedia

public Multimedia()
Method Detail

playSound

public static void playSound(String name)

getSound

private static AudioClip getSound(String name)

getAnimatedIcon

public static AnimatedIcon getAnimatedIcon(String name)

getAnimatedIcon0

private static AnimatedIcon getAnimatedIcon0(String name)

getImage

public static Image getImage(String name)

resolve

private static String resolve(String name)

main

public static void main(String[] argv)


Copyright © Fraunhofer Gesellschaft. All Rights Reserved.