Class VerticalLayout

  • All Implemented Interfaces:
    java.awt.LayoutManager

    public class VerticalLayout
    extends java.lang.Object
    implements java.awt.LayoutManager
    A simple layout manager, which aligns all components in a vertical flow layout.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private boolean useSizeFromParent
      Defines, whether to use the parents size or whether to compute the size from the parent's childs during the layouting.
    • Constructor Summary

      Constructors 
      Constructor Description
      VerticalLayout()
      DefaultConstructor.
      VerticalLayout​(boolean useParent)
      Creates a new vertical layout.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addLayoutComponent​(java.lang.String name, java.awt.Component comp)
      Adds the specified component with the specified name to the layout.
      boolean isUseSizeFromParent()
      Returns, whether the parent's defined size is used during the layouting, or whether the childs are used to compute the size.
      void layoutContainer​(java.awt.Container parent)
      Lays out the container in the specified panel.
      java.awt.Dimension minimumLayoutSize​(java.awt.Container parent)
      Calculates the minimum size dimensions for the specified panel given the components in the specified parent container.
      java.awt.Dimension preferredLayoutSize​(java.awt.Container parent)
      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
    • Field Detail

      • useSizeFromParent

        private final boolean useSizeFromParent
        Defines, whether to use the parents size or whether to compute the size from the parent's childs during the layouting.
    • Constructor Detail

      • VerticalLayout

        public VerticalLayout()
        DefaultConstructor.
      • VerticalLayout

        public VerticalLayout​(boolean useParent)
        Creates a new vertical layout. If useParent is set to true, the parents size will be used when performing the layouting, else only the parents childs are used to compute the layout.
        Parameters:
        useParent - defines, whether the parent's size is used.
    • Method Detail

      • 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 to be removed
      • preferredLayoutSize

        public java.awt.Dimension preferredLayoutSize​(java.awt.Container parent)
        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:
        parent - the component to be laid out
        Returns:
        the preferred layout size
        See Also:
        minimumLayoutSize(java.awt.Container)
      • minimumLayoutSize

        public java.awt.Dimension minimumLayoutSize​(java.awt.Container parent)
        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:
        parent - the component to be laid out
        Returns:
        the minimul layoutsize
        See Also:
        preferredLayoutSize(java.awt.Container)
      • isUseSizeFromParent

        public boolean isUseSizeFromParent()
        Returns, whether the parent's defined size is used during the layouting, or whether the childs are used to compute the size.
        Returns:
        true, if the parent's size is used, false otherwise.
      • layoutContainer

        public void layoutContainer​(java.awt.Container parent)
        Lays out the container in the specified panel.
        Specified by:
        layoutContainer in interface java.awt.LayoutManager
        Parameters:
        parent - the component which needs to be laid out