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.
-
centerMode
- Center image within component display area.
-
fileName
- Name of file, if any, associated with this image.
-
image
- Image that this viewer is displaying.
-
url
- URL of the image being displayed.
-
ImageViewer()
- Create default image viewer.
-
ImageViewer(Image)
- Create image viewer with image.
-
ImageViewer(String)
- Crate image viewer with filename.
-
ImageViewer(URL)
- Create image viewer with URL.
-
getCenterMode()
- Obtain current image centering mode.
-
getFileName()
- Obtain the filename associated with the current image.
-
getImage()
- Obtain the image currently being displayed.
-
getURL()
- Obtain the URL associated with the current image.
-
minimumSize()
- Returns the minimum dimensions to properly display this component.
-
paint(Graphics)
- Paints this component using the given graphics context.
-
preferredSize()
- Returns the recommended dimensions to properly display this component.
-
setCenterMode(boolean)
- Specify or change the image centering mode.
-
setFileName(String)
- Specify or change the image filename.
-
setImage(Image)
- Set or change the current image.
-
setURL(URL)
- Specify or change the image URL.
image
protected Image image
- Image that this viewer is displaying.
fileName
protected String fileName
- Name of file, if any, associated with this image.
url
protected URL url
- URL of the image being displayed.
centerMode
protected boolean centerMode
- Center image within component display area.
ImageViewer
public ImageViewer()
- Create default image viewer.
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
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
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
setFileName
public void setFileName(String str)
- Specify or change the image filename.
- Parameters:
- str - name of file containing image source
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
setURL
public void setURL(URL aUrl)
- Specify or change the image URL.
- Parameters:
- aUrl - the URL of the image to be displayed
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
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
getCenterMode
public boolean getCenterMode()
- Obtain current image centering mode.
- Returns:
- returns true if image is centered in component area
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
getImage
public Image getImage()
- Obtain the image currently being displayed.
- Returns:
- the image currently displayed or null if no image
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
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
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