Class NullLayoutManager

  • All Implemented Interfaces:
    java.awt.LayoutManager, java.awt.LayoutManager2, java.io.Serializable

    public class NullLayoutManager
    extends java.lang.Object
    implements java.awt.LayoutManager2, java.io.Serializable
    A layout manager that doesn't move things around. Attempts to set the bounds of components to accomodate them but doesn't move them.
    See Also:
    Serialized Form
    • Constructor Summary

      Constructors 
      Constructor Description
      NullLayoutManager()
      Constructs a NullLayoutManager object.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addLayoutComponent​(java.awt.Component comp, java.lang.Object constraints)
      Adds the specified component to the layout, using the specified constraint object.
      void addLayoutComponent​(java.lang.String name, java.awt.Component comp)
      Adds the specified component with the specified name to the layout.
      float getLayoutAlignmentX​(java.awt.Container target)
      Returns the alignment along the x axis.
      float getLayoutAlignmentY​(java.awt.Container target)
      Returns the alignment along the y axis.
      void invalidateLayout​(java.awt.Container target)
      Invalidates the layout, indicating that if the layout manager has cached information it should be discarded.
      void layoutContainer​(java.awt.Container target)
      Lays out the container.
      java.awt.Dimension maximumLayoutSize​(java.awt.Container target)
      Returns the maximum size of this component.
      java.awt.Dimension minimumLayoutSize​(java.awt.Container target)
      Calculates the minimum size dimensions for the specified panel given the components in the specified parent container.
      java.awt.Dimension preferredLayoutSize​(java.awt.Container target)
      Calculates the preferred size dimensions for the specified panel given the components in the specified parent container.
      void removeLayoutComponent​(java.awt.Component comp)
      Removes the specified component from the layout.
      • Methods inherited from class java.lang.Object

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

      • NullLayoutManager

        public NullLayoutManager()
        Constructs a NullLayoutManager object.
    • Method Detail

      • minimumLayoutSize

        public java.awt.Dimension minimumLayoutSize​(java.awt.Container target)
        Calculates the minimum size dimensions for the specified panel given the components in the specified parent container.
        Specified by:
        minimumLayoutSize in interface java.awt.LayoutManager
        Parameters:
        target - The component to be laid out.
        Returns:
        The minimum size.
        See Also:
        preferredLayoutSize(java.awt.Container)
      • preferredLayoutSize

        public java.awt.Dimension preferredLayoutSize​(java.awt.Container target)
        Calculates the preferred size dimensions for the specified panel given the components in the specified parent container.
        Specified by:
        preferredLayoutSize in interface java.awt.LayoutManager
        Parameters:
        target - The component to be laid out.
        Returns:
        A size deemed suitable for laying out the container.
        See Also:
        minimumLayoutSize(java.awt.Container)
      • maximumLayoutSize

        public java.awt.Dimension maximumLayoutSize​(java.awt.Container target)
        Returns the maximum size of this component.
        Specified by:
        maximumLayoutSize in interface java.awt.LayoutManager2
        Parameters:
        target - The component to be laid out.
        Returns:
        The maximum size for the container.
        See Also:
        preferredLayoutSize(java.awt.Container)
      • addLayoutComponent

        public void addLayoutComponent​(java.lang.String name,
                                       java.awt.Component comp)
        Adds the specified component with the specified name to the layout.
        Specified by:
        addLayoutComponent in interface java.awt.LayoutManager
        Parameters:
        name - the component name
        comp - the component to be added
      • removeLayoutComponent

        public void removeLayoutComponent​(java.awt.Component comp)
        Removes the specified component from the layout.
        Specified by:
        removeLayoutComponent in interface java.awt.LayoutManager
        Parameters:
        comp - the component ot be removed
      • layoutContainer

        public void layoutContainer​(java.awt.Container target)
        Lays out the container.
        Specified by:
        layoutContainer in interface java.awt.LayoutManager
        Parameters:
        target - The container which needs to be laid out.
      • addLayoutComponent

        public void addLayoutComponent​(java.awt.Component comp,
                                       java.lang.Object constraints)
        Adds the specified component to the layout, using the specified constraint object.
        Specified by:
        addLayoutComponent in interface java.awt.LayoutManager2
        Parameters:
        comp - the component to be added
        constraints - where/how the component is added to the layout.
      • getLayoutAlignmentX

        public float getLayoutAlignmentX​(java.awt.Container target)
        Returns the alignment along the x axis. This specifies how the component would like to be aligned relative to other components. The value should be a number between 0 and 1 where 0 represents alignment along the origin, 1 is aligned the furthest away from the origin, 0.5 is centered, etc.
        Specified by:
        getLayoutAlignmentX in interface java.awt.LayoutManager2
        Parameters:
        target - The target container.
        Returns:
        The X-axis alignment.
      • getLayoutAlignmentY

        public float getLayoutAlignmentY​(java.awt.Container target)
        Returns the alignment along the y axis. This specifies how the component would like to be aligned relative to other components. The value should be a number between 0 and 1 where 0 represents alignment along the origin, 1 is aligned the furthest away from the origin, 0.5 is centered, etc.
        Specified by:
        getLayoutAlignmentY in interface java.awt.LayoutManager2
        Parameters:
        target - The target container.
        Returns:
        The Y-axis alignment.
      • invalidateLayout

        public void invalidateLayout​(java.awt.Container target)
        Invalidates the layout, indicating that if the layout manager has cached information it should be discarded.
        Specified by:
        invalidateLayout in interface java.awt.LayoutManager2
        Parameters:
        target - The target container.