FileDocCategorySizeDatePackage
ImageViewerCanvas.javaAPI DocGlassfish v2 API2826Mon May 14 15:29:52 BST 2007com.sun.activation.viewers

ImageViewerCanvas

public class ImageViewerCanvas extends Canvas

Fields Summary
private Image
canvas_image
Constructors Summary
public ImageViewerCanvas()
The constructor

  
       
   
    
	
    
Methods Summary
public java.awt.DimensiongetPreferredSize()
getPreferredSize

      Dimension d = null;
      
      if(canvas_image == null)
	{
	  d = new Dimension(200, 200);
	}
      else
	d = new Dimension(canvas_image.getWidth(this), 
			  canvas_image.getHeight(this));

      return d;
    
public voidpaint(java.awt.Graphics g)
paint method


      if(canvas_image != null)
	g.drawImage(canvas_image, 0, 0, this);

    
public voidsetImage(java.awt.Image new_image)
set the image

      canvas_image = new_image;
      this.invalidate();
      this.repaint();