All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class symantec.itools.multimedia.ImageViewer

java.lang.Object
   |
   +----java.awt.Component
           |
           +----java.awt.Canvas
                   |
                   +----symantec.itools.multimedia.ImageViewer

public class ImageViewer
extends Canvas
ImageViewer component. Provides a platform-independent display of an Image.


Variable Index

 o centerMode
Center image within component display area.
 o fileName
Name of file, if any, associated with this image.
 o image
Image that this viewer is displaying.
 o url
URL of the image being displayed.

Constructor Index

 o ImageViewer()
Create default image viewer.
 o ImageViewer(Image)
Create image viewer with image.
 o ImageViewer(String)
Crate image viewer with filename.
 o ImageViewer(URL)
Create image viewer with URL.

Method Index

 o getCenterMode()
Obtain current image centering mode.
 o getFileName()
Obtain the filename associated with the current image.
 o getImage()
Obtain the image currently being displayed.
 o getURL()
Obtain the URL associated with the current image.
 o minimumSize()
Returns the minimum dimensions to properly display this component.
 o paint(Graphics)
Paints this component using the given graphics context.
 o preferredSize()
Returns the recommended dimensions to properly display this component.
 o setCenterMode(boolean)
Specify or change the image centering mode.
 o setFileName(String)
Specify or change the image filename.
 o setImage(Image)
Set or change the current image.
 o setURL(URL)
Specify or change the image URL.

Variables

 o image
  protected Image image
Image that this viewer is displaying.

 o fileName
  protected String fileName
Name of file, if any, associated with this image.

 o url
  protected URL url
URL of the image being displayed.

 o centerMode
  protected boolean centerMode
Center image within component display area.

Constructors

 o ImageViewer
  public ImageViewer()
Create default image viewer.

 o ImageViewer
  public ImageViewer(String str) throws MalformedURLException
Crate image viewer with filename. The specified filename is used as the image source.

Parameters:
str - name of file containing the image source
Throws: MalformedURLException
Thrown if URL cannot be generated from filename
 o ImageViewer
  public ImageViewer(URL url)
Create image viewer with URL. The specified URL is used as the image source.

Parameters:
url - the URL of the image to be displayed
 o ImageViewer
  public ImageViewer(Image img)
Create image viewer with image. The specified image is used as the image source

Parameters:
img - the image to be displayed

Methods

 o setFileName
  public void setFileName(String str)
Specify or change the image filename.

Parameters:
str - name of file containing image source
 o getFileName
  public String getFileName()
Obtain the filename associated with the current image.

Returns:
the name of the file, if any, associated with this image. If no file is associated with this image, returns null
 o setURL
  public void setURL(URL aUrl)
Specify or change the image URL.

Parameters:
aUrl - the URL of the image to be displayed
 o getURL
  public URL getURL()
Obtain the URL associated with the current image. If the image was specified by file name, or URL, it will have a URL which indicates its source. Images created using the constructor with an Image parameter will have no associated URL.

Returns:
the name of the URL, if any, associated with this image. If no URL is associated with this image, returns null
 o setCenterMode
  public void setCenterMode(boolean flag)
Specify or change the image centering mode. Image may be centered, or drawn at the top left of the component area.

Parameters:
flag - center the image when true
 o getCenterMode
  public boolean getCenterMode()
Obtain current image centering mode.

Returns:
returns true if image is centered in component area
 o setImage
  public void setImage(Image img)
Set or change the current image. Call this method if you want to specify directly the image to display.

Parameters:
img - the image to be displayed
 o getImage
  public Image getImage()
Obtain the image currently being displayed.

Returns:
the image currently displayed or null if no image
 o paint
  public void paint(Graphics g)
Paints this component using the given graphics context. This is a standard Java AWT method which typically gets called by the AWT to handle painting this component. It paints this component using the given graphics context. The graphics context clipping region is set to the bounding rectangle of this component and its <0,0> coordinate is this component's top-left corner. The image is optionally centered depending on the centerMode flag.

Parameters:
g - the graphics context used for painting
Overrides:
paint in class Canvas
See Also:
repaint, update
 o preferredSize
  public Dimension preferredSize()
Returns the recommended dimensions to properly display this component. This is a standard Java AWT method which gets called to determine the recommended size of this component.

Returns:
If no image has been loaded, a dimension of 10 by 10 is returned. If an image has been loaded, the height and width of the image is returned.
Overrides:
preferredSize in class Component
See Also:
minimumSize
 o minimumSize
  public Dimension minimumSize()
Returns the minimum dimensions to properly display this component. This is a standard Java AWT method which gets called to determine the minimum size of this component.

Returns:
If no image has been loaded, a dimension of 10 by 10 is returned. If an image has been loaded, the height and width of the image is returned.
Overrides:
minimumSize in class Component
See Also:
preferredSize

All Packages  Class Hierarchy  This Package  Previous  Next  Index