Class VerticalFlowLayout

java.lang.Object
cnuphys.splot.edit.VerticalFlowLayout
All Implemented Interfaces:
LayoutManager, LayoutManager2, Serializable

public class VerticalFlowLayout extends Object implements LayoutManager2, Serializable
See Also:
  • Field Details Link icon

  • Constructor Details Link icon

    • VerticalFlowLayout Link icon

      public VerticalFlowLayout()
      Constructs a new VerticalFlowLayout.
    • VerticalFlowLayout Link icon

      public VerticalFlowLayout(boolean uniformWidths, int vGap)
      Constructs a new VerticalFlowLayout with your own width sizing type and vertical gap values.
      Parameters:
      uniformWidths - size the widths of the component to be uniform or not
      vGap - vertical gap
  • Method Details Link icon

    • addLayoutComponent Link icon

      public void addLayoutComponent(String name, Component comp)
      Adds the specified component to the layout.
      Specified by:
      addLayoutComponent in interface LayoutManager
      Parameters:
      name - this is ignored
      comp - the component to be added
      Throws:
      IllegalArgumentException - Invalid component or constraint.
    • removeLayoutComponent Link icon

      public void removeLayoutComponent(Component comp)
      Remove the specified component.
      Specified by:
      removeLayoutComponent in interface LayoutManager
      Parameters:
      comp - the component to be removed
      Throws:
      IllegalArgumentException - Invalid component.
    • minimumLayoutSize Link icon

      public Dimension minimumLayoutSize(Container parent)
      Gets the minimum dimensions needed to lay out the component contained in the specified target container.
      Specified by:
      minimumLayoutSize in interface LayoutManager
      Parameters:
      parent - the Container on which to do the layout
      Returns:
      minimum layout size
      See Also:
    • preferredLayoutSize Link icon

      public Dimension preferredLayoutSize(Container parent)
      Gets the preferred dimensions for this layout given the components in the specified target container.
      • For the horizontal size, this will go through all of the components and get the widest one and add the external and internal horizontal paddings.
      • For the vertical size, this will add up the heights of all of the components and add in the internal and external vertical paddings.
      Specified by:
      preferredLayoutSize in interface LayoutManager
      Parameters:
      parent - the Container on which to do the layout
      Returns:
      preferred preferred layout size
      See Also:
    • layoutContainer Link icon

      public void layoutContainer(Container parent)
      Layout the components within the specified container
      Specified by:
      layoutContainer in interface LayoutManager
      Parameters:
      parent - the container that is being layed out
      See Also:
    • addLayoutComponent Link icon

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

      public Dimension maximumLayoutSize(Container target)
      Returns the maximum size of this component.
      Specified by:
      maximumLayoutSize in interface LayoutManager2
      See Also:
    • getLayoutAlignmentX Link icon

      public float getLayoutAlignmentX(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 LayoutManager2
    • getLayoutAlignmentY Link icon

      public float getLayoutAlignmentY(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 LayoutManager2
    • invalidateLayout Link icon

      public void invalidateLayout(Container target)
      Invalidates the layout, indicating that if the layout manager has cached information it should be discarded.
      Specified by:
      invalidateLayout in interface LayoutManager2
    • areWidthsUniform Link icon

      public boolean areWidthsUniform()
      See if the widths are set to uniform.
      Returns:
      uniform width flag
    • getVerticalGap Link icon

      public int getVerticalGap()
      Get the vertical gap value.
      Returns:
      vertical gap
    • getExternalPadLeft Link icon

      public int getExternalPadLeft()
      Returns the left external horizontal padding. This is the space between the widest component in the column and the left edge.
      Returns:
      Left external horizontal padding.
    • getExternalPadRight Link icon

      public int getExternalPadRight()
      Returns the right external horizontal padding. This is the space between the widest component in the column and the left right edge.
      Returns:
      Right external horizontal padding.
    • getExternalPadTop Link icon

      public int getExternalPadTop()
      Returns the top external vertical padding. This is the space between the top component and the top edge.
      Returns:
      Top external vertical padding.
    • getExternalPadBottom Link icon

      public int getExternalPadBottom()
      Returns the bottom external vertical padding. This is the space between the bottom component and the bottom edge.
      Returns:
      Bottom external vertical padding.
    • getInternalPadX Link icon

      public int getInternalPadX()
      Get the internal horizontal padding. This is a simple way to grow the horizontal preferred size of all of the components by a certain amount. It works great on buttons, because their preferred size is usually not wide enough to look good.
      Returns:
      internal horizontal padding
    • getInternalPadY Link icon

      public int getInternalPadY()
      Get the internal vertical padding. This is a simple way to grow the vertical preferred size of all of the components by a certain amount. It works great on buttons, because their preferred size is usually too short.
      Returns:
      internal vertical padding
    • setUniformWidths Link icon

      public void setUniformWidths(boolean uniformWidths)
      Set the uniform width flag. If you set this to true, the alignment value is ignored.
      Parameters:
      uniformWidths -
      • true = make all the widths uniform (sizing to match the widest)
      • false = let all components take their various preferred widths
    • setVerticalGap Link icon

      public void setVerticalGap(int vGap)
      Set the vertical gap value.
      Parameters:
      vGap - vertical gap
    • setExternalPadLeft Link icon

      public void setExternalPadLeft(int padding)
      Set the left external horizontal padding. This is the space between the widest component in the column and the edge.
      Parameters:
      padding - the amount of padding in pixels.
    • setExternalPadRight Link icon

      public void setExternalPadRight(int padding)
      Set the right external horizontal padding. This is the space between the widest component in the column and the edge.
      Parameters:
      padding - the amount of padding in pixels.
    • setExternalPadTop Link icon

      public void setExternalPadTop(int padding)
      Set the top external vertical padding. This is the space between the top and the top edge.
      Parameters:
      padding - the amount of padding in pixels.
    • setExternalPadBottom Link icon

      public void setExternalPadBottom(int padding)
      Set the bottom external vertical padding. This is the space between the bottom and the bottom edge.
      Parameters:
      padding - the amount of padding in pixels.
    • setInternalPadX Link icon

      public void setInternalPadX(int padding)
      Set the internal horizontal padding. This is a simple way to grow the horizontal preferred size of all of the components by a certain amount. It works great on buttons, because their preferred size is usually not wide enough to look good.
      Parameters:
      padding - internal horizontal padding
    • setInternalPadY Link icon

      public void setInternalPadY(int padding)
      Set the internal vertical padding. This is a simple way to grow the vertical preferred size of all of the components by a certain amount. It works great on buttons, because their preferred size is usually too short.
      Parameters:
      padding - internal vertical padding