Module org.jcommon

Class JImageFrame

    • Constructor Detail

      • 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 Detail

      • 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.
      • 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:
        getImage()
      • 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(String, boolean)
      • 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:
        isLayerDisplayed(String)
      • 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(boolean), fit()
      • 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:
        isAutoFit(), fit()
      • fit

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