java.awt
public class MediaTracker extends Object implements Serializable
Field Summary | |
---|---|
static int | ABORTED Indicates that the loading operation has been aborted. |
static int | COMPLETE Indicates that the media has been successfully and completely loaded. |
static int | ERRORED Indicates that an error has occured during loading of the media. |
static int | LOADING Indicates that the media is still loading. |
Constructor Summary | |
---|---|
MediaTracker(Component c)
Constructs a new MediaTracker for the component c . |
Method Summary | |
---|---|
void | addImage(Image image, int id)
Adds an image to the tracker with the specified ID .
|
void | addImage(Image image, int id, int width, int height)
Adds an image to the tracker with the specified ID .
|
boolean | checkAll()
Checks if all media objects have finished loading, i.e. are
{@link #COMPLETE}, {@link #ABORTED} or {@link #ERRORED}.
|
boolean | checkAll(boolean load)
Checks if all media objects have finished loading, i.e. are
{@link #COMPLETE}, {@link #ABORTED} or {@link #ERRORED}.
|
boolean | checkID(int id)
Checks if the media objects with ID have completed loading.
|
boolean | checkID(int id, boolean load)
Checks if the media objects with ID have completed loading.
|
Object[] | getErrorsAny()
Returns all media objects that have encountered errors during loading.
|
Object[] | getErrorsID(int id)
Returns all media objects with the specified ID that have encountered
an error.
|
boolean | isErrorAny()
Checks if any of the registered media objects has encountered an error
during loading.
|
boolean | isErrorID(int id)
Returns true if any of the media objects with ID
have encountered errors during loading, false otherwise.
|
void | removeImage(Image image)
Removes an image from this MediaTracker.
|
void | removeImage(Image image, int id)
Removes an image with the specified ID from this MediaTracker.
|
void | removeImage(Image image, int id, int width, int height)
Removes an image with the specified ID and scale from this MediaTracker.
|
int | statusAll(boolean load)
Returns the status flags of all registered media objects ORed together.
|
int | statusID(int id, boolean load)
Returns the status flags of the media objects with the specified ID
ORed together.
|
void | waitForAll()
Waits for all media objects to finish loading, either by completing
successfully or by aborting or encountering an error.
|
boolean | waitForAll(long ms)
Waits for all media objects to finish loading, either by completing
successfully or by aborting or encountering an error.
|
void | waitForID(int id)
Waits for all media objects with the specified ID to finish loading,
either by completing successfully or by aborting or encountering an error.
|
boolean | waitForID(int id, long ms)
Waits for all media objects with the specified ID to finish loading,
either by completing successfully or by aborting or encountering an error.
|
c
. The
component should be the component that uses the media (i.e. draws it).
Parameters: c the Component that wants to use the media
ID
.
Parameters: image the image to be added id the ID of the tracker list to which the image is added
ID
.
The image is expected to be rendered with the specified width and
height.
Parameters: image the image to be added id the ID of the tracker list to which the image is added width the width of the image height the height of the image
checkAll(false)
.
Returns: if all media objects have finished loading either by beeing complete, have been aborted or errored.
load
is true
then a call to this
method starts loading the media objects.
Parameters: load if true
this method starts loading objects
that are not already loading
Returns: if all media objects have finished loading either by beeing complete, have been aborted or errored.
ID
have completed loading.
Parameters: id the ID of the media objects to check
Returns: true
if all media objects with ID
have successfully finished
ID
have completed loading.
If load
is true
then media objects that
are not already loading will be started to load.
Parameters: id the ID of the media objects to check load if set to true
then media objects that are
not already loading are started
Returns: true
if all media objects with ID
have successfully finished
Returns: an array of all media objects that have encountered errors
or null
if there were no errors at all
Parameters: id the ID of the media objects to check
Returns: an array of all media objects with the specified ID that have encountered an error
Returns: true
if at least one media object has encountered
an error during loading, false
otherwise
true
if any of the media objects with ID
have encountered errors during loading, false otherwise.
Parameters: id the ID of the media objects to check
Returns: true
if any of the media objects with ID
have encountered errors during loading, false otherwise
Parameters: image the image to be removed
Parameters: image the image to be removed
Parameters: image the image to be removed
load
is true
then media objects that
are not already loading will be started to load.
Parameters: load if set to true
then media objects that are
not already loading are started
Returns: the status flags of all tracked media objects ORed together
load
is true
then media objects that
are not already loading will be started to load.
Parameters: load if set to true
then media objects that are
not already loading are started
Returns: the status flags of all tracked media objects ORed together
Throws: InterruptedException if another thread interrupted the current thread while waiting
ms
milliseconds. If the
media objects have not completed loading within this timeframe, this
method returns false
, otherwise true
.
Parameters: ms timeframe in milliseconds to wait for the media objects to finish
Returns: true
if all media objects have successfully loaded
within the timeframe, false
otherwise
Throws: InterruptedException if another thread interrupted the current thread while waiting
Parameters: id the ID of the media objects to wait for
Throws: InterruptedException if another thread interrupted the current thread while waiting
ms
milliseconds. If the
media objects have not completed loading within this timeframe, this
method returns false
, otherwise true
.
Parameters: id the ID of the media objects to wait for ms timeframe in milliseconds to wait for the media objects to finish
Returns: true
if all media objects have successfully loaded
within the timeframe, false
otherwise
Throws: InterruptedException if another thread interrupted the current thread while waiting