Class ssfd.OverlayPanel
All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class ssfd.OverlayPanel

java.lang.Object
   |
   +----java.awt.Component
           |
           +----java.awt.Container
                   |
                   +----java.awt.Panel
                           |
                           +----ssfd.OverlayPanel

public class OverlayPanel
extends Panel
implements Observer
This class was developed with a particular application in mind (hinted at by the names of the images), but may possibly find other applications. The goal is to overlay two images. The top image is filtered and redrawn whenever the ObservableDbl calls its update method.
Version:
2.0 02-19-97
Author:
Daren Stotler
See Also:
ICMFilter, SteadyStateFusionDemo, ObservableDbl

Constructor Index

 o OverlayPanel(Applet, String, String, int, int, ObservableDbl, IndexColorModel)
Loads the images, sets their size variables, and otherwise initializes the OverlayPanel instance variables.

Method Index

 o minimumSize()
Sets a minimum Dimension for this panel, in case anybody cares.
 o paint(Graphics)
Draws the base and overlaid images.
 o preferredSize()
Sets the size to be that of the base image.
 o update(Observable, Object)
This is the requisite method for the Observer interface.

Constructors

 o OverlayPanel
  public OverlayPanel(Applet foo,
                      String imgname1,
                      String imgname2,
                      int xs,
                      int ys,
                      ObservableDbl od,
                      IndexColorModel icm)
Loads the images, sets their size variables, and otherwise initializes the OverlayPanel instance variables.
Parameters:
foo - needed to get the images
imgname1 - name of the first (base) image
imgname2 - name of the second (overlaid) image
xs - horizontal shift of the origin of the overlaid image relative to the base image
ys - vertical shift of the origin of the overlaid image relative to the base image
od - (observable) value used to select the color in the IndexColorModel; the double is converted to an integer using its allowed range of values and the number of colors in the IndexColorModel
icm - list of colors which will be used to depict the current value of od in the overlaid image

Methods

 o update
  public void update(Observable obs,
                     Object arg)
This is the requisite method for the Observer interface. It's called whenever an Observable changes. At this point, its new value and the IndexColorModel are used to filter the overlaid image.
See Also:
update
 o paint
  public void paint(Graphics g)
Draws the base and overlaid images. If the overlaid image exists it is used. Otherwise, the original is drawn.
Parameters:
g - graphics context on which the drawing is done
Overrides:
paint in class Component
 o minimumSize
  public Dimension minimumSize()
Sets a minimum Dimension for this panel, in case anybody cares.
Returns:
"minimum" Dimension of the panel
Overrides:
minimumSize in class Container
 o preferredSize
  public Dimension preferredSize()
Sets the size to be that of the base image.
Returns:
size of the image
Overrides:
preferredSize in class Container

All Packages  Class Hierarchy  This Package  Previous  Next  Index