Class ImageSelectionGroupPanel

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible

public class ImageSelectionGroupPanel extends JPanel
An ImageSelectionGroupPanel allows the selection of a group of ReadableImages and contains the mechanism for adding images to the group, removing images from the group, etc. Usually used to select a set of input images for processing.

For an example of the use of a ImageSelectionGroupPanel, see the Image Algebra Tool in Jim.

See Also:
  • Field Details

  • Constructor Details

    • ImageSelectionGroupPanel

      public ImageSelectionGroupPanel(MessageShower parent)
      Creates a new ImageSelectionGroupPanel, that is contained within a parent JFrame, and with initially one image in the set of images, and a minimum of one image in the set.
      Parameters:
      parent - the parent MessageShower that contains this ImageSelectionGroupPanel. If parent is non-null, it will have its cursor set appropriately when the ImageSelectionGroupPanel is busy.
    • ImageSelectionGroupPanel

      public ImageSelectionGroupPanel(MessageShower parent, int minNImages, ImageSelectionGroupPanel.ComponentGenerator componentGenerator, double weight)
      Creates a new ImageSelectionGroupPanel, that is contained within a parent JFrame, and with minimum number and initial number of images in the set given by the argument.
      Parameters:
      parent - the parent MessageShower that contains this ImageSelectionGroupPanel. If parent is non-null, it will have its cursor set appropriately when the ImageSelectionGroupPanel is busy.
      minNImages - the minimum number of images in the set of images in the group.
      componentGenerator - if non-null, the ComponentGenerator that can generate the user for each image panel.
      weight - the weight for the GridBagConstraints that will be applied when panels are added.
  • Method Details

    • getUserComponent

      public Component getUserComponent(int i)
      Returns the user component associated with the image selection panel at the given index.
      Parameters:
      i - the index.
      Returns:
      the user component at index i.
    • getUserComponents

      public Component[] getUserComponents()
      Returns all user components.
      Returns:
      an array of all user components.
    • addFileChangeCommitListener

      public void addFileChangeCommitListener(ChangeListener listener)
      Adds a listener that listens for the file name change being committed.
      Parameters:
      listener - the listener to add.
    • removeFileChangeCommitListener

      public void removeFileChangeCommitListener(ChangeListener listener)
      Removes a listener that listens for the file name change being committed.
      Parameters:
      listener - the listener to remove.
    • addFileTextEditListener

      public void addFileTextEditListener(ChangeListener listener)
      Adds a listener that listens for the file text being edited.
      Parameters:
      listener - the listener to add.
    • removeFileTextEditListener

      public void removeFileTextEditListener(ChangeListener listener)
      removed a listener that listens for the file text being edited.
      Parameters:
      listener - the listener to remove.
    • add

      public void add()
      Adds another ImageSelectionGroupMemberPanel to this group.
    • setMaxNImages

      public void setMaxNImages(int max)
      Sets the maximum number of images that can be loaded. By default, the maximum is 4096 (at the time of writing).
      Parameters:
      max - the maximum number of images that can be loaded.
    • getNImages

      public int getNImages()
      Returns the number of ImageSelectionGroupMemberPanels in this group.
      Returns:
      the number of ImageSelectionGroupMemberPanels in this group.
    • getReadableImage

      Returns the ReadableImage for the ImageSelectionGroupMemberPanel at particular location in the group.
      Parameters:
      index - the position in the group (indexed from zero).
      Returns:
      the java.io.File set for the ImageSelectionGroupMemberPanel at the given position.
      Throws:
      IndexOutOfBoundsException - if the index is less than zero or greater than or equal to the number of panels in the group.
      UnsetImageException - if no image has been set in the ImageSelectionGroupMemberPanel at the given position.
      InvalidImageException - if the image at the requsted position is invalid.
    • clearAllImages

      public void clearAllImages()
      Clear all images from this ImageSelectionGroupPanel. All file fields are set to the current working directory.
    • getWorkingDirectory

      public File getWorkingDirectory()
      Returns the "current working directory" for this ImageSelectionGroupPanel. When the user chooses a new image to set in the panel, the ImageFileChooser used to select the image starts with the directory set to the current working directory. When the user, using the ImageFileChooser, moves to a different directory, the current working directory is set to the new directory.
      Returns:
      the current working directory for this ImageSelectionGroupPanel.
    • setImageFilterClass

      public void setImageFilterClass(Class<? extends ReadableImage> c)
      Sets the class of image that will be filtered when the user first chooses a new image to set in the panel. The ImageFileChooser used to select the image starts with the correct image filter set.
      Parameters:
      c - the class of a valid image type to filter, e.g. com.xinapse.multisliceimage.UNC.UNCImage.
    • getImageFilterClass

      public Class<? extends ReadableImage> getImageFilterClass()
      Returns the class of image that will be filtered when the user first chooses a new image to set in the panel. The ImageFileChooser used to select the image starts with the correct image filter set.
      Returns:
      the class of image that will be filtered when the user first chooses a new image to set in the panel.
    • setNImages

      public void setNImages(int nImages)
      Sets the number of ImageSelectionGroupMemberPanels in this group.
      Parameters:
      nImages - the number of ImageSelectionGroupMemberPanels to be set for this group.