Class GridFlowLayout

  • All Implemented Interfaces:
    LayoutManager, LayoutManager2

    public class GridFlowLayout
    extends Object
    implements LayoutManager2
    Ce layout place les composants de gauche à droite ou de droite à gauche selon la valeur de Component.getComponentOrientation(). Si un composant n'a pas assez de place pour se mettre sur la ligne courant, il est mis sur la ligne suivante et les composants sont redimensionnés pour prendre le maximum de place disponible sur la ligne. Si le container est dans un JViewport (ou JScrollPane), ce layout essai de ne jamais faire apparaitre le ScrollBar horizontal.

    Tous les composants ont la même taille.

    • Constructor Detail

      • GridFlowLayout

        public GridFlowLayout()
        GridFlowLayout constructor make a GridFlowLayout with default value (1) for gap
      • GridFlowLayout

        public GridFlowLayout​(int hgap,
                              int vgap)
        GridFlowLayout constructor
        Parameters:
        hgap - the horizontal gap between two components
        vgap - the vertical gap between two components
    • Method Detail

      • getHgap

        public int getHgap()
        Gets the horizontal gap between components.
        Returns:
        the horizontal gap between components
        See Also:
        setHgap(int)
      • setHgap

        public void setHgap​(int hgap)
        Sets the horizontal gap between components.
        Parameters:
        hgap - the horizontal gap between components
        See Also:
        getHgap()
      • getVgap

        public int getVgap()
        Gets the vertical gap between components.
        Returns:
        the vertical gap between components
        See Also:
        setVgap(int)
      • setVgap

        public void setVgap​(int vgap)
        Sets the vertical gap between components.
        Parameters:
        vgap - the vertical gap between components
        See Also:
        getVgap()
      • addLayoutComponent

        public void addLayoutComponent​(Component comp,
                                       Object constraints)
        Method addLayoutComponent
        Specified by:
        addLayoutComponent in interface LayoutManager2
        Parameters:
        comp - the component to add
        constraints - a constraint which is a Number (position)
      • setConstraints

        public void setConstraints​(Component comp,
                                   Number constraints)
        Method setConstraints
        Parameters:
        comp - the compoenent
        constraints -
      • getConstraints

        public Number getConstraints​(Component comp)
        Method getConstraints
        Parameters:
        comp -
        Returns:
        a number that corresponding to the constraint
      • getLayoutAlignmentX

        public float getLayoutAlignmentX​(Container target)
        Method getLayoutAlignmentX
        Specified by:
        getLayoutAlignmentX in interface LayoutManager2
        Parameters:
        target -
        Returns:
        the X layout alignement
      • getLayoutAlignmentY

        public float getLayoutAlignmentY​(Container target)
        Method getLayoutAlignmentY
        Specified by:
        getLayoutAlignmentY in interface LayoutManager2
        Parameters:
        target -
        Returns:
        the Y layout alignement
      • getComponentVisibleCount

        protected int getComponentVisibleCount​(Container parent)
        Method getComponentVisibleCount
        Parameters:
        parent -
        Returns:
        an integer that corresponding to the number of visible components
      • getMaxWidthHeight

        protected Dimension getMaxWidthHeight​(Container parent)
        Method getMaxWidthHeight
        Parameters:
        parent -
        Returns:
        the max size
      • getMinWidthHeight

        protected Dimension getMinWidthHeight​(Container parent)
        Method getMinWidthHeight
        Parameters:
        parent -
        Returns:
        the dimension of this layout
      • computeOrder

        public Component[] computeOrder​(Component[] components)
        Method []
        Parameters:
        components -
        Returns:
        une tablean de composants contenus dans le layout
      • main

        public static void main​(String[] args)