Class SimpleImagePane

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible

public class SimpleImagePane extends JPanel
A basic Swing widget to display a RenderedImage. Used with JAITools example applications.
Since:
1.1
Author:
Michael Bedward
See Also:
  • Constructor Details

    • SimpleImagePane

      public SimpleImagePane()
      Creatss a new instance.
  • Method Details

    • setImage

      public void setImage(RenderedImage image)
      Sets the image to display and repaints.
      Parameters:
      image - the image to display
    • clear

      public void clear()
      Removes the current display image and repaints.
    • resetTransform

      public void resetTransform()
      Forces recalculation of the AffineTransform used to scale the image display.
    • getImageCoords

      public Point getImageCoords(Point paneCoords, Point imageCoords)
      Converts a window position into the corresponding image position. If imageCoords is not null it will be set to the image position, otherwise a new Point object will be created. In either case, the image position is returned for convenience.

      If no image is currently set, null is returned.

      Parameters:
      paneCoords - window position
      imageCoords - object to receive image position, or null
      Returns:
      image position or null if no image is set
    • getPaneCoords

      public Point getPaneCoords(Point imageCoords, Point paneCoords)
      Converts an image position into the corresponding window position. If paneCoords is not null it will be set to the window position, otherwise a new Point object will be created. In either case, the window position is returned for convenience.

      If no image is currently set, null is returned.

      Parameters:
      imageCoords - image position
      paneCoords - object to receive window position, or null
      Returns:
      window position or null if no image is set