- java.lang.Object
-
- ij.gui.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.
-
-
-
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 interfacejava.awt.LayoutManager
-
removeLayoutComponent
public void removeLayoutComponent(java.awt.Component comp)
Not used by this class.- Specified by:
removeLayoutComponent
in interfacejava.awt.LayoutManager
-
preferredLayoutSize
public java.awt.Dimension preferredLayoutSize(java.awt.Container target)
Returns the preferred dimensions for this layout.- Specified by:
preferredLayoutSize
in interfacejava.awt.LayoutManager
-
minimumLayoutSize
public java.awt.Dimension minimumLayoutSize(java.awt.Container target)
Returns the minimum dimensions for this layout.- Specified by:
minimumLayoutSize
in interfacejava.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 interfacejava.awt.LayoutManager
-
-