Class JImageFrame

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible, RootPaneContainer, WindowConstants

public class JImageFrame extends JFrame
A swing component that enables to display images by embedding a JImagePanel.

This frame provides various operations on the view (zoom, moving, ...) and helper methods for correspondence between image space and display space.

This underlying image panel also manages features that enable to display interactive overlays on the panel.

Since:
1.0.0
Version:
"1.0.14" - b202111241200L
Author:
Julien SEINTURIER - Université de Toulon / CNRS LIS umr 7020 - github.com/jorigin/jcommon (contact@jorigin.org)
See Also:
  • Constructor Details

    • JImageFrame

      public JImageFrame()
      Create a new frame dedicated to image display.
    • JImageFrame

      public JImageFrame(BufferedImage image)
      Create a new frame that displays the given image.
      Parameters:
      image - the image to display.
    • JImageFrame

      public JImageFrame(String title, Dimension size, BufferedImage image)
      Create a new frame that displays the given image.
      Parameters:
      title - the title of the frame.
      size - the size of the frame in pixels.
      image - the image to display.
  • Method Details

    • showImageFrame

      public static void showImageFrame(String title, Dimension size, Point location, BufferedImage image, boolean autoFit)
      Create and display an image frame.
      Parameters:
      title - the title of the frame.
      size - the size (width × height) of the frame in pixels.
      location - the location (x, y) of the frame on the display.
      image - the image to display.
      autoFit - true if the frame has to fit the view when resized and false otherwise.
    • initGUI

      protected void initGUI()
      Initialization of the Graphical User Interface components.
    • refreshGUI

      protected void refreshGUI()
      Refresh of the Graphical User Interface components.
    • getImage

      public BufferedImage getImage()
      Get the image that is displayed within the frame.
      Returns:
      the image that is displayed within the frame.
      See Also:
    • setImage

      public void setImage(BufferedImage image)
      Set the image to display within the frame.
      Parameters:
      image - the image to display within the frame.
      See Also:
    • getImageFeatures

      public List<JImageFeature> getImageFeatures(String layer)
      Get the image features that are attached to the underlying image panel. If the layer does not exist, it is created. In this case, the layer will not be displayed until a call to setLayerDisplayed(layer, true). If the layer exists, all previous existing features are deleted.
      Parameters:
      layer - the layer that holds the features.
      Returns:
      the image features that are attached to the underlying image panel.
      See Also:
    • setImageFeatures

      public void setImageFeatures(String layer, List<JImageFeature> features)
      Set the image features to attach to the underlying image panel.
      Parameters:
      layer - the layer that holds the features.
      features - the image features to attach to the underlying image panel.
      See Also:
    • isLayerDisplayed

      public boolean isLayerDisplayed(String layer)
      Get if the layer is actually displaying within the underlying image panel.
      Parameters:
      layer - the layer to check.
      Returns:
      true if the layer is actually displaying and false otherwise.
      See Also:
    • setLayerDisplayed

      public void setLayerDisplayed(String layer, boolean displayed)
      Set if the layer has to be displayed within the underlying image panel.
      Parameters:
      layer - the layer to set.
      displayed - true if the layer has to be displayed and false otherwise.
      See Also:
    • isAutoFit

      public boolean isAutoFit()
      Get if the underlying image panel fits the view when its resized.
      Returns:
      true if the panel fits the view when its resized and false otherwise.
      See Also:
    • setAutoFit

      public void setAutoFit(boolean autoFit)
      Set if the underlying image panel has to fit the view when its resized.
      Parameters:
      autoFit - true if the panel fits the view when its resized and false otherwise.
      See Also:
    • fit

      public void fit()
      Fit the actual view to display the whole image.