|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjava.lang.Thread
javoids.ImageMap
public class ImageMap
A class to load images mapped to an enum name for the items in this game.
| Nested Class Summary | |
|---|---|
static class |
ImageMap.Name
An enum for each item name. |
| Nested classes/interfaces inherited from class java.lang.Thread |
|---|
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler |
| Field Summary | |
|---|---|
private static java.util.HashMap<ImageMap.Name,javax.swing.ImageIcon> |
imageIcons
a mapping of image names to the created icons based on the loaded images |
private static java.util.HashMap<ImageMap.Name,java.lang.String> |
imageNames
a mapping of image names to image file names |
private static java.util.HashMap<ImageMap.Name,java.awt.Image> |
images
a mapping of image names to the loaded images |
private static long |
serialVersionUID
This is the version used for serializing/deserializing (storing/retrieving) this object |
| Fields inherited from class java.lang.Thread |
|---|
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
| Constructor Summary | |
|---|---|
ImageMap()
|
|
| Method Summary | |
|---|---|
java.awt.Image |
getImage(ImageMap.Name name)
|
javax.swing.ImageIcon |
getImageIcon(ImageMap.Name name)
|
java.util.HashMap<ImageMap.Name,java.awt.Image> |
getImages()
|
java.awt.Image |
getScaledImage(ImageMap.Name name,
int width,
int height,
int hints)
Scale an image from the list |
void |
putImage(ImageMap.Name name,
java.awt.Image image)
|
void |
run()
Load the images in a separate thread. |
int |
size()
|
java.lang.String |
toString()
Provide a String representation of this object. |
| Methods inherited from class java.lang.Thread |
|---|
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, yield |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
private static final long serialVersionUID
private static java.util.HashMap<ImageMap.Name,java.lang.String> imageNames
private static java.util.HashMap<ImageMap.Name,java.awt.Image> images
private static java.util.HashMap<ImageMap.Name,javax.swing.ImageIcon> imageIcons
| Constructor Detail |
|---|
public ImageMap()
| Method Detail |
|---|
public void run()
run in interface java.lang.Runnablerun in class java.lang.Threadpublic int size()
public java.awt.Image getImage(ImageMap.Name name)
name - the name (enum) of the item
public javax.swing.ImageIcon getImageIcon(ImageMap.Name name)
name - the name (enum) of the item
public java.awt.Image getScaledImage(ImageMap.Name name,
int width,
int height,
int hints)
name - the name (enum) of the itemwidth - the desired width of the imagesheight - the desired height of the imagehints - image rendering hints (see sun constants)
public java.util.HashMap<ImageMap.Name,java.awt.Image> getImages()
public void putImage(ImageMap.Name name,
java.awt.Image image)
name - the name (enum) of the itemimage - the image to associate with the provided namepublic java.lang.String toString()
toString in class java.lang.Thread
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||