acm.util
Class MovieClip

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by acm.util.MovieClip
All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable

public class MovieClip
extends Container

This class represents a video clip, which can be read from a QuickTime movie file or web-based resource.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
Field Summary
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
MovieClip(File file)
          Creates a MovieClip object from the specified movie file.
MovieClip(String filename)
          Creates a MovieClip object from the specified movie file.
MovieClip(URL url)
          Creates a MovieClip object from the specified network URL.
 
Method Summary
 void disableController()
          Disables the QuickTime controller from the bottom of the movie, making it disappear from the window.
 void enableController()
          Enables the QuickTime controller displayed at the bottom of the movie.
 int getControllerHeight()
          Returns the height of the QuickTime controller, measured in pixels.
 double getDuration()
          Returns the duration of a movie (in seconds).
 int getFrameCount()
          Returns the number of frames in a movie.
 int getFrameIndex()
          Returns the current frame index in the movie.
 double getFrameRate()
          Returns the frame rate of the movie.
 String getName()
          Returns the name of the movie, which is typically the file name from which it was read.
 double getPlaybackRate()
          Returns the playback rate, which is a floating-point number indicating the speed and direction of playback.
 Dimension getPreferredSize()
          Returns the desired height of the movie panel, which is taken from the underlying movie, taking account of the controller, if any.
 double getVolume()
          Returns the playback volume setting for the movie, which is a number between 0 (silent) and 1 (maximum volume).
 boolean isControllerEnabled()
          Returns true if the QuickTime controller is enabled.
 void loop()
          Plays the movie in a continuous audio loop.
 void play()
          Starts the movie from its current position.
 void rewind()
          Rewinds the movie to the beginning.
 void setFrameIndex(int frameIndex)
          Sets the current frame index.
 void setName(String name)
          Sets a name to identify the movie.
 void setPlaybackRate(double rate)
          Sets the playback rate for the movie.
 void setVolume(double volume)
          Sets the playback volume setting for the movie, which is a number between 0 (silent) and 1 (maximum volume).
 void stop()
          Stops the playback of the movie.
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addNotify, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getInsets, getLayout, getListeners, getMaximumSize, getMinimumSize, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paint, paintComponents, paramString, preferredSize, print, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, removeNotify, setComponentZOrder, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, setLayout, transferFocusBackward, transferFocusDownCycle, update, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getAccessibleContext, getBackground, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setPreferredSize, setSize, setSize, setVisible, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MovieClip

public MovieClip(File file)
Creates a MovieClip object from the specified movie file.

Parameters:
file - A File object from which the movie is read

MovieClip

public MovieClip(String filename)
Creates a MovieClip object from the specified movie file.

Parameters:
filename - The file from which the movie is read

MovieClip

public MovieClip(URL url)
Creates a MovieClip object from the specified network URL.

Parameters:
url - A network URL containing the movie
Method Detail

disableController

public void disableController()
Disables the QuickTime controller from the bottom of the movie, making it disappear from the window. This call has no effect if no controller is already disabled.


enableController

public void enableController()
Enables the QuickTime controller displayed at the bottom of the movie. This call has no effect if a controller is already enabled.


getControllerHeight

public int getControllerHeight()
Returns the height of the QuickTime controller, measured in pixels. If no controller is installed, getControllerHeight returns 0.

Returns:
The height of the QuickTime controller (in pixels)

getDuration

public double getDuration()
Returns the duration of a movie (in seconds).

Returns:
The duration of a movie (in seconds)

getFrameCount

public int getFrameCount()
Returns the number of frames in a movie.

Returns:
The number of frames in a movie

getFrameIndex

public int getFrameIndex()
Returns the current frame index in the movie.

Returns:
The current frame index in the movie

getFrameRate

public double getFrameRate()
Returns the frame rate of the movie.

Returns:
The frame rate of the movie (in frames/second)

getName

public String getName()
Returns the name of the movie, which is typically the file name from which it was read.

Overrides:
getName in class Component
Returns:
The name of the movie

getPlaybackRate

public double getPlaybackRate()
Returns the playback rate, which is a floating-point number indicating the speed and direction of playback. The value 1.0 indicates normal speed, 2.0 indicates a movie running at double speed, and 0.5 indicates a movie running at half speed. Negative values indicate that the movie should run in reverse, so that a playback rate of -1.0 specifies that the movie should run backwards at normal speed.

Returns:
The playback rate for the movie

getPreferredSize

public Dimension getPreferredSize()
Returns the desired height of the movie panel, which is taken from the underlying movie, taking account of the controller, if any.

Overrides:
getPreferredSize in class Container
Returns:
The desired height of the movie panel

getVolume

public double getVolume()
Returns the playback volume setting for the movie, which is a number between 0 (silent) and 1 (maximum volume).

Returns:
The playback volume setting for the movie

isControllerEnabled

public boolean isControllerEnabled()
Returns true if the QuickTime controller is enabled.

Returns:
true if the controller is enabled

loop

public void loop()
Plays the movie in a continuous audio loop.


play

public void play()
Starts the movie from its current position.


rewind

public void rewind()
Rewinds the movie to the beginning. This method is useful after you have stopped a movie and want to replay it from the beginning.


setFrameIndex

public void setFrameIndex(int frameIndex)
Sets the current frame index.

Parameters:
frameIndex - The current frame index in the movie

setName

public void setName(String name)
Sets a name to identify the movie.

Overrides:
setName in class Component
Parameters:
name - The name to use for the movie

setPlaybackRate

public void setPlaybackRate(double rate)
Sets the playback rate for the movie. The value 1.0 indicates normal speed, 2.0 indicates a movie running at double speed, and 0.5 indicates a movie running at half speed. Negative values indicate that the movie should run in reverse, so that a playback rate of -1.0 specifies that the movie should run backwards at normal speed.

Parameters:
rate - The new playback rate for the movie

setVolume

public void setVolume(double volume)
Sets the playback volume setting for the movie, which is a number between 0 (silent) and 1 (maximum volume).

Parameters:
volume - The new volume setting for the movie

stop

public void stop()
Stops the playback of the movie.