Module ij
Package ij.gui

Class ImageLayout

  • All Implemented Interfaces:
    java.awt.LayoutManager

    public class ImageLayout
    extends java.lang.Object
    implements java.awt.LayoutManager
    This is a custom layout manager that supports resizing of zoomed images. It's based on FlowLayout, but with vertical and centered flow.
    • Constructor Summary

      Constructors 
      Constructor Description
      ImageLayout​(ImageCanvas ic)
      Creates a new ImageLayout with center alignment.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addLayoutComponent​(java.lang.String name, java.awt.Component comp)
      Not used by this class.
      void ignoreNonImageWidths​(boolean ignoreNonImageWidths)
      Determines whether to ignore the width of non-image components when calculating the preferred width (default false, i.e.
      void layoutContainer​(java.awt.Container target)
      Lays out the container and calls ImageCanvas.resizeCanvas() to adjust the image canvas size as needed.
      java.awt.Dimension minimumLayoutSize​(java.awt.Container target)
      Returns the minimum dimensions for this layout.
      java.awt.Dimension preferredLayoutSize​(java.awt.Container target)
      Returns the preferred dimensions for this layout.
      void removeLayoutComponent​(java.awt.Component comp)
      Not used by this class.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ImageLayout

        public ImageLayout​(ImageCanvas ic)
        Creates a new ImageLayout with center alignment.
    • Method Detail

      • addLayoutComponent

        public void addLayoutComponent​(java.lang.String name,
                                       java.awt.Component comp)
        Not used by this class.
        Specified by:
        addLayoutComponent in interface java.awt.LayoutManager
      • removeLayoutComponent

        public void removeLayoutComponent​(java.awt.Component comp)
        Not used by this class.
        Specified by:
        removeLayoutComponent in interface java.awt.LayoutManager
      • preferredLayoutSize

        public java.awt.Dimension preferredLayoutSize​(java.awt.Container target)
        Returns the preferred dimensions for this layout.
        Specified by:
        preferredLayoutSize in interface java.awt.LayoutManager
      • minimumLayoutSize

        public java.awt.Dimension minimumLayoutSize​(java.awt.Container target)
        Returns the minimum dimensions for this layout.
        Specified by:
        minimumLayoutSize in interface java.awt.LayoutManager
      • ignoreNonImageWidths

        public void ignoreNonImageWidths​(boolean ignoreNonImageWidths)
        Determines whether to ignore the width of non-image components when calculating the preferred width (default false, i.e. the maximum of the widths of all components is used). When true, components that do not fit the window will be truncated at the right. The width of the 0th component (the ImageCanvas) is always taken into account.
      • layoutContainer

        public void layoutContainer​(java.awt.Container target)
        Lays out the container and calls ImageCanvas.resizeCanvas() to adjust the image canvas size as needed.
        Specified by:
        layoutContainer in interface java.awt.LayoutManager