All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class tea.set.ImageCanvas

java.lang.Object
   |
   +----java.awt.Component
           |
           +----java.awt.Canvas
                   |
                   +----tea.set.ImageCanvas

public class ImageCanvas
extends Canvas
ImageCanvas is a simple widget for displaying an image. The default size of ImageCanvas is the size of the image. If the ImageCanvas is resized to another size, the image is automatically scaled to fit the size of the widget.

 Example:
 add(new ImageCanvas(getImage(url)), "Center");
 

ImageCanvas supports the following properties:
Property NameProperty TypeDescription
ImageImage Canvas image object.

See Also:
ImageLabel

Constructor Index

 o ImageCanvas()
Construct an empty ImageCanvas().
 o ImageCanvas(Image)
Construct an ImageCanvas with specified image.

Method Index

 o getImage()
Return the image inside this canvas.
 o getMinimumSize()
Return the minimum size of the image.
 o getPreferredSize()
Return the preferred size of the image.
 o paint(Graphics)
Paint the image.
 o setImage(Image)
Set the image for this ImageCanvas.

Constructors

 o ImageCanvas
 public ImageCanvas()
Construct an empty ImageCanvas(). ImageCanvas.setImage() must be called before use.

 o ImageCanvas
 public ImageCanvas(Image image)
Construct an ImageCanvas with specified image.

Parameters:
image - canvas image.

Methods

 o getImage
 public Image getImage()
Return the image inside this canvas.

Returns:
canvas image.
 o setImage
 public synchronized void setImage(Image image)
Set the image for this ImageCanvas.

Parameters:
image - canvas image.
 o getMinimumSize
 public Dimension getMinimumSize()
Return the minimum size of the image.

Returns:
minimum size.
Overrides:
getMinimumSize in class Component
 o getPreferredSize
 public Dimension getPreferredSize()
Return the preferred size of the image.

Returns:
preferred size.
Overrides:
getPreferredSize in class Component
 o paint
 public void paint(Graphics g)
Paint the image.

Parameters:
g - Graphics context of this component.
Overrides:
paint in class Canvas

All Packages  Class Hierarchy  This Package  Previous  Next  Index