|
Sharkysoft home | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.awt.Component | +--java.awt.Canvas | +--lava.gui.SizedCanvas | +--lava.gui.ImageCanvas
SizedCanvas that displays an Image.
Details: An ImageCanvas is a SizedCanvas that displays a single image. The image can be centered (default) or flush against the canvas' sides or corners, or stretched horizontally and/or vertically to span the entire canvas. ImageCanvas supports animated images, such as animated GIFs.
Inner classes inherited from class java.awt.Canvas |
java.awt.Canvas.AccessibleAWTCanvas |
Inner classes inherited from class java.awt.Component |
java.awt.Component.AccessibleAWTComponent |
Field Summary | |
protected int |
alignment
Image alignment. |
protected java.awt.Image |
image
The Image displayed in this Canvas . |
protected java.awt.Dimension |
max_size
The maximum size of this Canvas . |
protected java.awt.Dimension |
min_size
The minimum size of this Canvas . |
protected java.awt.Point |
position
Image position. |
protected java.awt.Dimension |
pref_size
The preferred size of this Canvas . |
protected java.awt.Dimension |
size
Image size. |
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 | |
ImageCanvas(java.awt.Dimension dim,
java.awt.Image image)
Initializes this ImageCanvas to have the given dimension and image content. |
|
ImageCanvas(java.awt.Dimension dim,
java.awt.Image image,
int alignment)
Initializes this ImageCanvas to have the given dimension and image content. |
|
ImageCanvas(java.awt.Image image)
Initializes with image. |
Method Summary | |
java.awt.Image |
getImage()
Returns the current image. |
java.awt.Dimension |
getMaximumSize()
Reports the maximum display size of this Canvas. |
java.awt.Dimension |
getMinimumSize()
Reports the minimum display size of this Canvas. |
java.awt.Dimension |
getPreferredSize()
Reports the preferrred display size of this Canvas. |
boolean |
imageUpdate(java.awt.Image img,
int infoflags,
int x,
int y,
int width,
int height)
Progressively renders image. |
void |
paint(java.awt.Graphics g)
Draws this Canvas using the specified Graphics object. |
void |
reshape(int x,
int y,
int w,
int h)
Changes bounds (deprecated). |
void |
setImage(java.awt.Image image)
Sets the image to be displayed in this Canvas. |
void |
setImageAlignment(int new_alignment)
Changes the image alignment. |
void |
setImagePosition(java.awt.Point p)
Moves the image. |
void |
setImageSize(java.awt.Dimension d)
Sets image size. |
void |
setMaximumSize(java.awt.Dimension max_size)
Sets the maximum size. |
void |
setMinimumSize(java.awt.Dimension min_size)
Sets the minimum size. |
void |
setPreferredSize(java.awt.Dimension pref_size)
Sets the preferred size. |
void |
setSizes(java.awt.Dimension min_size,
java.awt.Dimension pref_size,
java.awt.Dimension max_size)
Sets the minimum, preferred, and maximum sizes. |
Methods inherited from class java.awt.Canvas |
addNotify, getAccessibleContext |
Methods inherited from class java.awt.Component |
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addPropertyChangeListener, addPropertyChangeListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, deliverEvent, disable, disableEvents, dispatchEvent, doLayout, enable, enable, enableEvents, enableInputMethods, firePropertyChange, getAlignmentX, getAlignmentY, getBackground, getBounds, getBounds, getColorModel, getComponentAt, getComponentAt, getComponentOrientation, getCursor, getDropTarget, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getInputContext, getInputMethodRequests, getListeners, getLocale, getLocation, getLocation, getLocationOnScreen, getName, getParent, getPeer, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, inside, invalidate, isDisplayable, isDoubleBuffered, isEnabled, isFocusTraversable, isLightweight, isOpaque, isShowing, isValid, isVisible, keyDown, keyUp, layout, list, list, list, list, list, locate, location, lostFocus, minimumSize, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, paramString, postEvent, preferredSize, prepareImage, prepareImage, print, printAll, processComponentEvent, processEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFont, setForeground, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, show, size, toString, transferFocus, update, validate |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
protected java.awt.Image image
Image
displayed in this Canvas
.protected int alignment
Details: This member indicates the current alignment, as set during construction or in calls to setImageAlignment
.
Default value: CENTER
protected java.awt.Point position
Details: position is the location, in the Canvas, of the upper-left corner of the image. The value of position is updated by calls to setImage, setImageAlignment, and setImagePosition.
protected java.awt.Dimension size
Details: size is the display size of this ImageCanvas' image. size may be different from the image's natural size if the ImageCanvas is set to display a stretched image. A null value indicates that the image is to be rendered at its natural size, without stretching. Because of this, settting size to null results in more efficient image rendering.
protected java.awt.Dimension min_size
Canvas
.protected java.awt.Dimension pref_size
Canvas
.protected java.awt.Dimension max_size
Canvas
.Constructor Detail |
public ImageCanvas(java.awt.Image image)
Details: This constructor sets the current image and sets the canvas size to be the same as the image. This constructor will not return until the image's dimensions have been determined, and will fail if the dimensions cannot be determined.
image
- the imagepublic ImageCanvas(java.awt.Dimension dim, java.awt.Image image)
ImageCanvas
to have the given dimension and image content. A null image indicates that no image is to be displayed (yet). The image can be changed by calling setImage
.dim
- the minimum size of this Canvasimage
- the image currently displayed in this canvaspublic ImageCanvas(java.awt.Dimension dim, java.awt.Image image, int alignment)
ImageCanvas
to have the given dimension and image content. A null image indicates that no image is to be displayed (yet). This image can be changed by calling setImage
.dim
- the minimum size of this Canvasimage
- the image currently displayed in this canvasMethod Detail |
public void setImage(java.awt.Image image)
image
- the new imagepublic java.awt.Image getImage()
public void paint(java.awt.Graphics g)
Canvas
using the specified Graphics
object. Called by the AWT subsystem.paint
in class java.awt.Canvas
g
- the graphics objectpublic void setImageAlignment(int new_alignment)
Details: setImageAlignment changes the alignment of the image displayed in the canvas. new_alignment
may be Alignment.NORTH
, Alignment.SOUTH
, Alignment.EAST
, Alignment.WEST
, or any sensible combination of these constants. (Combinations are formed by OR-ing.)
setImageAlignment preserves the image's current display size unless the new alignment requires stretching the image to a new size.
new_alignment
- the new alignment settingpublic void setImagePosition(java.awt.Point p)
Details: setImagePosition moves the image so that its upper-left corner is the pixel at canvas coordinate p.
p
- the new positionpublic void setImageSize(java.awt.Dimension d)
Details: setImageSize sets the display dimensions of the image. Normally, this method should only be called when the intent is to stretch or shrink the image from its normal size. If d is null, the image will be displayed at its natural size.
d
- the new image sizepublic boolean imageUpdate(java.awt.Image img, int infoflags, int x, int y, int width, int height)
Details: imageUpdate responds to progressively available image data. This method is used internally and should not be called by user threads.
imageUpdate
in class java.awt.Component
public void reshape(int x, int y, int w, int h)
Details: Whether you call setBounds
, setSize
, resize
, or what-Component.reshape
is the method ultimately called by the AWT whenever a component's dimensions are changed. Nevertheless, the retards at Sun deprecated reshape
by introducing a setBounds
method, whose implementation does nothing but forward the parameters to reshape anyway. Thus, in order to augment resizing behavior, ImageCanvas
must override reshape
, even though it is deprecated. Don't forget, however, that reshape
is still considered to be a deprecated method name and therefore this method should never be called (unless you work for Sun). Use setBounds
instead.
reshape
in class java.awt.Component
public java.awt.Dimension getMinimumSize()
getMinimumSize
in class java.awt.Component
min_size
public java.awt.Dimension getPreferredSize()
getPreferredSize
in class java.awt.Component
pref_size
public java.awt.Dimension getMaximumSize()
getMaximumSize
in class java.awt.Component
max_size
public void setMinimumSize(java.awt.Dimension min_size)
Details: An IllegalArgumentException
is thrown if the resulting size set is not ordered.
min_size
- the new minimum sizepublic void setPreferredSize(java.awt.Dimension pref_size)
Details: An IllegalArgumentException
is thrown if the resulting size set is not ordered.
min_size
- the new preferred sizepublic void setMaximumSize(java.awt.Dimension max_size)
Details: An IllegalArgumentException
is thrown if the resulting size set is not ordered.
min_size
- the new maximum sizepublic void setSizes(java.awt.Dimension min_size, java.awt.Dimension pref_size, java.awt.Dimension max_size)
Details: An IllegalArgumentException
is thrown if the resulting size set is not ordered.
min_size
- the new minimum sizepref_size
- the new preferred sizemax_size
- the new maximum size
|
Sharkysoft home | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |