|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.awt.MediaTracker
Safe:
Field Summary | |
static int |
ABORTED
Enabled: Flag indicating that the downloading of media was aborted. |
static int |
COMPLETE
Enabled: Flag indicating that the downloading of media was completed successfully. |
(package private) static int |
DONE
|
static int |
ERRORED
Enabled: Flag indicating that the downloading of media encountered an error. |
(package private) MediaEntry |
head
The head of the list of Images that is being
tracked by the MediaTracker . |
static int |
LOADING
Enabled: Flag indicating that media is currently being loaded. |
private static long |
serialVersionUID
|
(package private) Component |
target
A given Component that will be
tracked by a media tracker where the image will
eventually be drawn. |
Constructor Summary | |
MediaTracker(Component comp)
Enabled: Creates a media tracker to track images for a given component. |
Method Summary | |
void |
addImage(Image image,
int id)
Enabled: Adds an image to the list of images being tracked by this media tracker. |
void |
addImage(Image image,
int id,
int w,
int h)
Enabled: Adds a scaled image to the list of images being tracked by this media tracker. |
boolean |
checkAll()
Enabled: Checks to see if all images being tracked by this media tracker have finished loading. |
boolean |
checkAll(boolean load)
Enabled: Checks to see if all images being tracked by this media tracker have finished loading. |
private boolean |
checkAll(boolean load,
boolean verify)
|
boolean |
checkID(int id)
Enabled: Checks to see if all images tracked by this media tracker that are tagged with the specified identifier have finished loading. |
boolean |
checkID(int id,
boolean load)
Enabled: Checks to see if all images tracked by this media tracker that are tagged with the specified identifier have finished loading. |
private boolean |
checkID(int id,
boolean load,
boolean verify)
|
Object[] |
getErrorsAny()
Enabled: Returns a list of all media that have encountered an error. |
Object[] |
getErrorsID(int id)
Enabled: Returns a list of media with the specified ID that have encountered an error. |
boolean |
isErrorAny()
Enabled: Checks the error status of all of the images. |
boolean |
isErrorID(int id)
Enabled: Checks the error status of all of the images tracked by this media tracker with the specified identifier. |
void |
removeImage(Image image)
Enabled: Removes the specified image from this media tracker. |
void |
removeImage(Image image,
int id)
Enabled: Removes the specified image from the specified tracking ID of this media tracker. |
void |
removeImage(Image image,
int id,
int width,
int height)
Enabled: Removes the specified image with the specified width, height, and ID from this media tracker. |
(package private) void |
setDone()
|
int |
statusAll(boolean load)
Enabled: Calculates and returns the bitwise inclusive OR of the status of all media that are tracked by this media tracker. |
private int |
statusAll(boolean load,
boolean verify)
|
int |
statusID(int id,
boolean load)
Enabled: Calculates and returns the bitwise inclusive OR of the status of all media with the specified identifier that are tracked by this media tracker. |
private int |
statusID(int id,
boolean load,
boolean verify)
|
void |
waitForAll()
Enabled: Starts loading all images tracked by this media tracker. |
boolean |
waitForAll(long ms)
Enabled: Starts loading all images tracked by this media tracker. |
void |
waitForID(int id)
Enabled: Starts loading all images tracked by this media tracker with the specified identifier. |
boolean |
waitForID(int id,
long ms)
Enabled: Starts loading all images tracked by this media tracker with the specified identifier. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
Component target
Component
that will be
tracked by a media tracker where the image will
eventually be drawn.
MediaTracker()
MediaEntry head
Images
that is being
tracked by the MediaTracker
.
addImage()
,
removeImage()
private static final long serialVersionUID
public static final int LOADING
java.awt.MediaTracker#statusAll
,
java.awt.MediaTracker#statusID
public static final int ABORTED
java.awt.MediaTracker#statusAll
,
java.awt.MediaTracker#statusID
public static final int ERRORED
java.awt.MediaTracker#statusAll
,
java.awt.MediaTracker#statusID
public static final int COMPLETE
java.awt.MediaTracker#statusAll
,
java.awt.MediaTracker#statusID
static final int DONE
Constructor Detail |
public MediaTracker(Component comp)
comp
- the component on which the images
will eventually be drawnMethod Detail |
public void addImage(Image image, int id)
image
- the image to be trackedid
- an identifier used to track this imagepublic void addImage(Image image, int id, int w, int h)
image
- the image to be trackedid
- an identifier that can be used to track this imagew
- the width at which the image is renderedh
- the height at which the image is renderedpublic boolean checkAll()
This method does not start loading the images if they are not already loading.
If there is an error while loading or scaling an image, then that
image is considered to have finished loading. Use the
isErrorAny
or isErrorID
methods to
check for errors.
true
if all images have finished loading,
have been aborted, or have encountered
an error; false
otherwisejava.awt.MediaTracker#checkAll(boolean)
,
java.awt.MediaTracker#checkID
,
java.awt.MediaTracker#isErrorAny
,
java.awt.MediaTracker#isErrorID
public boolean checkAll(boolean load)
If the value of the load
flag is true
,
then this method starts loading any images that are not yet
being loaded.
If there is an error while loading or scaling an image, that
image is considered to have finished loading. Use the
isErrorAny
and isErrorID
methods to
check for errors.
load
- if true
, start loading any
images that are not yet being loaded
true
if all images have finished loading,
have been aborted, or have encountered
an error; false
otherwisejava.awt.MediaTracker#checkID
,
java.awt.MediaTracker#checkAll()
,
java.awt.MediaTracker#isErrorAny()
,
java.awt.MediaTracker#isErrorID(int)
private boolean checkAll(boolean load, boolean verify)
public boolean isErrorAny()
true
if any of the images tracked
by this media tracker had an error during
loading; false
otherwisejava.awt.MediaTracker#isErrorID
,
java.awt.MediaTracker#getErrorsAny
public Object[] getErrorsAny()
null
if
there are none with errorsjava.awt.MediaTracker#isErrorAny
,
java.awt.MediaTracker#getErrorsID
public void waitForAll() throws InterruptedException
If there is an error while loading or scaling an image, then that
image is considered to have finished loading. Use the
isErrorAny
or isErrorID
methods to
check for errors.
InterruptedException
java.awt.MediaTracker#waitForID(int)
,
java.awt.MediaTracker#waitForAll(long)
,
java.awt.MediaTracker#isErrorAny
,
java.awt.MediaTracker#isErrorID
public boolean waitForAll(long ms) throws InterruptedException
ms
argument has passed.
If there is an error while loading or scaling an image, then
that image is considered to have finished loading. Use the
isErrorAny
or isErrorID
methods to
check for errors.
ms
- the number of milliseconds to wait
for the loading to complete
true
if all images were successfully
loaded; false
otherwise
InterruptedException
java.awt.MediaTracker#waitForID(int)
,
java.awt.MediaTracker#waitForAll(long)
,
java.awt.MediaTracker#isErrorAny
,
java.awt.MediaTracker#isErrorID
public int statusAll(boolean load)
Possible flags defined by the
MediaTracker
class are LOADING
,
ABORTED
, ERRORED
, and
COMPLETE
. An image that hasn't started
loading has zero as its status.
If the value of load
is true
, then
this method starts loading any images that are not yet being loaded.
load
- if true
, start loading
any images that are not yet being loaded
java.awt.MediaTracker#statusID(int, boolean)
,
java.awt.MediaTracker#LOADING
,
java.awt.MediaTracker#ABORTED
,
java.awt.MediaTracker#ERRORED
,
java.awt.MediaTracker#COMPLETE
private int statusAll(boolean load, boolean verify)
public boolean checkID(int id)
This method does not start loading the images if they are not already loading.
If there is an error while loading or scaling an image, then that
image is considered to have finished loading. Use the
isErrorAny
or isErrorID
methods to
check for errors.
id
- the identifier of the images to check
true
if all images have finished loading,
have been aborted, or have encountered
an error; false
otherwisejava.awt.MediaTracker#checkID(int, boolean)
,
java.awt.MediaTracker#checkAll()
,
java.awt.MediaTracker#isErrorAny()
,
java.awt.MediaTracker#isErrorID(int)
public boolean checkID(int id, boolean load)
If the value of the load
flag is true
,
then this method starts loading any images that are not yet
being loaded.
If there is an error while loading or scaling an image, then that
image is considered to have finished loading. Use the
isErrorAny
or isErrorID
methods to
check for errors.
id
- the identifier of the images to checkload
- if true
, start loading any
images that are not yet being loaded
true
if all images have finished loading,
have been aborted, or have encountered
an error; false
otherwisejava.awt.MediaTracker#checkID(int, boolean)
,
java.awt.MediaTracker#checkAll()
,
java.awt.MediaTracker#isErrorAny()
,
java.awt.MediaTracker#isErrorID(int)
private boolean checkID(int id, boolean load, boolean verify)
public boolean isErrorID(int id)
id
- the identifier of the images to check
true
if any of the images with the
specified identifier had an error during
loading; false
otherwisejava.awt.MediaTracker#isErrorAny
,
java.awt.MediaTracker#getErrorsID
public Object[] getErrorsID(int id)
id
- the identifier of the images to check
null
if there are none with errorsjava.awt.MediaTracker#isErrorID
,
java.awt.MediaTracker#isErrorAny
,
java.awt.MediaTracker#getErrorsAny
public void waitForID(int id) throws InterruptedException
If there is an error while loading or scaling an image, then that
image is considered to have finished loading. Use the
isErrorAny
and isErrorID
methods to
check for errors.
id
- the identifier of the images to check
InterruptedException
java.awt.MediaTracker#waitForAll
,
java.awt.MediaTracker#isErrorAny()
,
java.awt.MediaTracker#isErrorID(int)
public boolean waitForID(int id, long ms) throws InterruptedException
ms
argument has passed.
If there is an error while loading or scaling an image, then that
image is considered to have finished loading. Use the
statusID
, isErrorID
, and
isErrorAny
methods to check for errors.
id
- the identifier of the images to checkms
- the length of time, in milliseconds, to wait
for the loading to complete
InterruptedException
java.awt.MediaTracker#waitForAll
,
java.awt.MediaTracker#waitForID(int)
,
java.awt.MediaTracker#statusID
,
java.awt.MediaTracker#isErrorAny()
,
java.awt.MediaTracker#isErrorID(int)
public int statusID(int id, boolean load)
Possible flags defined by the
MediaTracker
class are LOADING
,
ABORTED
, ERRORED
, and
COMPLETE
. An image that hasn't started
loading has zero as its status.
If the value of load
is true
, then
this method starts loading any images that are not yet being loaded.
id
- the identifier of the images to checkload
- if true
, start loading
any images that are not yet being loaded
java.awt.MediaTracker#statusAll(boolean)
,
java.awt.MediaTracker#LOADING
,
java.awt.MediaTracker#ABORTED
,
java.awt.MediaTracker#ERRORED
,
java.awt.MediaTracker#COMPLETE
private int statusID(int id, boolean load, boolean verify)
public void removeImage(Image image)
image
- the image to be removedjava.awt.MediaTracker#removeImage(java.awt.Image, int)
,
java.awt.MediaTracker#removeImage(java.awt.Image, int, int, int)
public void removeImage(Image image, int id)
Image
being tracked
under the specified ID are removed regardless of scale.
image
- the image to be removedid
- the tracking ID frrom which to remove the imagejava.awt.MediaTracker#removeImage(java.awt.Image)
,
java.awt.MediaTracker#removeImage(java.awt.Image, int, int, int)
public void removeImage(Image image, int id, int width, int height)
image
- the image to be removedid
- the tracking ID from which to remove the imagewidth
- the width to remove (-1 for unscaled)height
- the height to remove (-1 for unscaled)java.awt.MediaTracker#removeImage(java.awt.Image)
,
java.awt.MediaTracker#removeImage(java.awt.Image, int)
void setDone()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |