Class ImageSequenceViewer

java.lang.Object
org.loboevolution.img.ImageSequenceViewer

public class ImageSequenceViewer extends Object
A component for displaying a series of images. Supports paging through GUI as well as setting the current position via function setPosition(int). When the position is changed, the positionChanged() method is called. Subclasses should override this method to update the image according to the new position. Author Kaz Csaba
  • Constructor Details

    • ImageSequenceViewer

      public ImageSequenceViewer(int number)
      Creates a new sequence viewer that can display the specified number of images.
      Parameters:
      number - the number of images
      Throws:
      IllegalArgumentException - if the number is negative
    • ImageSequenceViewer

      public ImageSequenceViewer(int number, int startPos)
      Creates a new sequence viewer that can display the specified number of images.
      Parameters:
      number - the number of images
      startPos - the initial position of the viewer
      Throws:
      IllegalArgumentException - if the number is negative or the starting position is not valid
  • Method Details

    • getComponent

      public JComponent getComponent()
      Returns the Swing component for this sequence viewer.
      Returns:
      the component
    • positionChanged

      protected void positionChanged()
      Called when the current position of the viewer has changed. The default implementation does nothing. Subclasses should override this method to update the image.

      This method is not called from the constructor, but it is called before the viewer is made visible, so subclasses can safely use this method to set the initial image.

    • getImageViewer

      public ImageViewer getImageViewer()

      Getter for the field imageViewer.

      Returns:
      a ImageViewer object.
    • setPosition

      public void setPosition(int pos)
      Sets the position of the viewer.
      Parameters:
      pos - the new position of the viewer
      Throws:
      IllegalArgumentException - if the position is not valid
    • getPosition

      public int getPosition()
      Returns the current position of this image sequence shower.
      Returns:
      a Integer object.
    • createLocationDefinition

      protected JComponent createLocationDefinition()
      Creates and returns the component that displays the current position to the user. The default implementation creates a JLabel.
      Returns:
      the location component
    • updateLocationDefinition

      protected void updateLocationDefinition(int pos)
      Called when the current position changes to update the location component.
      Parameters:
      pos - the current position