|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.awt.Component | +--java.awt.Container | +--java.awt.Window | +--com.glaivestone.javax.awt.ImageWindow
A Window
on an Image
.
Note that this class only uses AWT classes and not any Swing classes.
Field Summary | |
static int |
DEFAULT_MEDIA_TRACKER_ID
The default MediaTracker ID used to wait for an image to be loaded, 0 . |
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 | |
ImageWindow(java.awt.Frame parent,
java.awt.Image image)
Create a new window with the given parent and image. |
Method Summary | |
void |
centerOnScreen()
Center this window on the screen. |
java.awt.Image |
getImage()
Get the image to display for the window. |
java.awt.MediaTracker |
getMediaTracker()
Get the MediaTracker used to load the image. |
boolean |
hasMediaTracker()
Returns whether or not the media tracker field has been set. |
boolean |
imageUpdate(java.awt.Image img,
int infoflags,
int x,
int y,
int width,
int height)
Implementation of the single ImageObserver interface method imageUpdate. |
boolean |
isImagePainted()
Get whether or not the image has been painted in the window. |
static ImageWindow |
newForFilenameImage(java.awt.Frame parent,
java.lang.String filename)
Create and return a new ImageWindow with the given parent Frame and image read from the given file name. |
static ImageWindow |
newForSystemResourceImage(java.awt.Frame parent,
java.lang.String filename)
Create and return a new ImageWindow with the given parent Frame and image read from the given file name on the system class path. |
static ImageWindow |
newImageWindow(java.awt.Frame parent,
java.awt.Image image)
Create and return a new ImageWindow with the given parent Frame and Image. |
void |
paint(java.awt.Graphics g)
Paints the window. |
void |
setImage(java.awt.Image image)
Set the image to display for the window. |
void |
setMediaTracker(java.awt.MediaTracker mediaTracker)
Set the MediaTracker used to load the image. |
boolean |
setSizeCheck(int width,
int height)
Resizes this component so that it has width and
height . |
void |
setSizeToImageSize()
Set the size of this window of the size the expression: this.getImage() . |
void |
setSizeToImageSize(java.awt.Image anImage)
Set the size of this window of the size of the given Image. |
java.lang.String |
toString()
|
void |
waitForImage()
Starts loading all images tracked by this media tracker with the DEFAULT_MEDIA_TRACKER_ID identifier. |
void |
waitForImage(int mediaTrackerID)
Starts loading all images tracked by this media tracker with the specified identifier. |
Methods inherited from class java.awt.Window |
addNotify, addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getAccessibleContext, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getGraphicsConfiguration, getInputContext, getListeners, getLocale, getMostRecentFocusOwner, getOwnedWindows, getOwner, getToolkit, getWarningString, getWindowFocusListeners, getWindowListeners, getWindowStateListeners, hide, isActive, isFocusableWindow, isFocusCycleRoot, isFocused, isShowing, pack, postEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, setCursor, setFocusableWindowState, setFocusCycleRoot, setLocationRelativeTo, show, toBack, toFront |
Methods inherited from class java.awt.Container |
add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, remove, remove, removeAll, removeContainerListener, removeNotify, setFocusTraversalKeys, setFocusTraversalPolicy, setFont, setLayout, transferFocusBackward, transferFocusDownCycle, update, validate |
Methods inherited from class java.awt.Component |
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, dispatchEvent, enable, enable, enableInputMethods, getBackground, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isOpaque, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocusInWindow, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, size, transferFocus, transferFocusUpCycle |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final int DEFAULT_MEDIA_TRACKER_ID
0
.
Constructor Detail |
public ImageWindow(java.awt.Frame parent, java.awt.Image image)
Method Detail |
public static ImageWindow newImageWindow(java.awt.Frame parent, java.awt.Image image)
public static ImageWindow newForFilenameImage(java.awt.Frame parent, java.lang.String filename)
public static ImageWindow newForSystemResourceImage(java.awt.Frame parent, java.lang.String filename)
public void centerOnScreen()
public void paint(java.awt.Graphics g)
paint
in class java.awt.Container
g
- the specified Graphics windowComponent.paint(java.awt.Graphics)
public void setSizeToImageSize(java.awt.Image anImage)
public void setSizeToImageSize()
this.getImage()
.
public boolean setSizeCheck(int width, int height)
width
and
height
.
If width
or height
equals -1
,
then return true
, indicating that the window size needs
to be set with a call to this method.
Otherwise, set the window size and return false
,
indicating that no further calls to this method is needed.
Component.setSize(int,int)
public boolean imageUpdate(java.awt.Image img, int infoflags, int x, int y, int width, int height)
imageUpdate
in interface java.awt.image.ImageObserver
imageUpdate
in class java.awt.Component
setSizeCheck(int,int)
public java.awt.Image getImage()
public boolean hasMediaTracker()
public java.awt.MediaTracker getMediaTracker()
public void setImage(java.awt.Image image)
public void setMediaTracker(java.awt.MediaTracker mediaTracker)
getMediaTracker()
.
public java.lang.String toString()
toString
in class java.awt.Component
public void waitForImage()
DEFAULT_MEDIA_TRACKER_ID
identifier.
This method waits until all the images with the specified identifier
have finished loading.
This method calls waitForImage(int)
with
DEFAULT_MEDIA_TRACKER_ID
waitForImage(int)
public void waitForImage(int mediaTrackerID)
This method uses a media tracker to load the window's image.
MediaTracker
,
MediaTracker.addImage(java.awt.Image,int)
,
MediaTracker.waitForID(int)
public boolean isImagePainted()
|
GFL 1.1 API | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |