Class SwingPercentLayoutAdapter

    • Constructor Detail

      • SwingPercentLayoutAdapter

        public SwingPercentLayoutAdapter​(PercentLayoutBase percentLayout)
        Creates a new instance of SwingPercentLayouAdaptert and sets the associated percent layout.
        Parameters:
        percentLayout - the percent layout object (must not be null)
        Throws:
        IllegalArgumentException - if the PercentLayoutBase object is null
    • Method Detail

      • getPercentLayout

        public PercentLayoutBase getPercentLayout()
        Returns a reference to the associated percent layout object.
        Returns:
        the percent layout object
      • getLayoutAlignmentX

        public float getLayoutAlignmentX​(Container container)
        Returns the layout alignment in X direction.
        Specified by:
        getLayoutAlignmentX in interface LayoutManager2
        Parameters:
        container - the associated container
        Returns:
        the layout alignment in X direction
      • getLayoutAlignmentY

        public float getLayoutAlignmentY​(Container container)
        Returns the layout alignment in Y direction.
        Specified by:
        getLayoutAlignmentY in interface LayoutManager2
        Parameters:
        container - the associated container
        Returns:
        the layout alignment in Y direction
      • invalidateLayout

        public void invalidateLayout​(Container container)
        Invalidates this layout. Clears all cached values.
        Specified by:
        invalidateLayout in interface LayoutManager2
        Parameters:
        container - the associated container
      • maximumLayoutSize

        public Dimension maximumLayoutSize​(Container container)
        Returns the maximum layout size. For this layout type there is no upper limit.
        Specified by:
        maximumLayoutSize in interface LayoutManager2
        Parameters:
        container - the container
        Returns:
        the maximum layout size
      • addLayoutComponent

        public void addLayoutComponent​(Component comp,
                                       Object constraints)
        Adds a component to this layout.
        Specified by:
        addLayoutComponent in interface LayoutManager2
        Parameters:
        comp - the component to add
        constraints - the constraints
      • addLayoutComponent

        public void addLayoutComponent​(String name,
                                       Component comp)
        Adds a component to this layout manager using the given name as constraints object.
        Specified by:
        addLayoutComponent in interface LayoutManager
        Parameters:
        name - the name
        comp - the component
      • removeLayoutComponent

        public void removeLayoutComponent​(Component c)
        Removes the specified component from the layout manager.
        Specified by:
        removeLayoutComponent in interface LayoutManager
        Parameters:
        c - the component to remove
      • layoutContainer

        public void layoutContainer​(Container container)
        Determines the coordinates and sizes of all components that belong to this layout.
        Specified by:
        layoutContainer in interface LayoutManager
        Parameters:
        container - the associated container
      • minimumLayoutSize

        public Dimension minimumLayoutSize​(Container container)
        Returns the minimum size of this layout. For this layout type this equals the preferred layout size.
        Specified by:
        minimumLayoutSize in interface LayoutManager
        Parameters:
        container - the associated container
        Returns:
        the minimum layout size
      • preferredLayoutSize

        public Dimension preferredLayoutSize​(Container container)
        Returns the preferred size of this layout.
        Specified by:
        preferredLayoutSize in interface LayoutManager
        Parameters:
        container - the associated container
        Returns:
        the preferred layout size
      • getComponent

        public Object getComponent​(int index)
        Returns the component with the given index.
        Specified by:
        getComponent in interface PercentLayoutPlatformAdapter
        Parameters:
        index - the index
        Returns:
        the component with this index
      • getConstraints

        public Object getConstraints​(int index)
        Returns the constraints for the component with the given index.
        Specified by:
        getConstraints in interface PercentLayoutPlatformAdapter
        Parameters:
        index - the index
        Returns:
        the constraints for the specified component
      • getMinimumComponentSize

        public int getMinimumComponentSize​(Object component,
                                           boolean vert)
        Returns the minimum size of the specified component in the given axis.
        Specified by:
        getMinimumComponentSize in interface PercentLayoutPlatformAdapter
        Parameters:
        component - the component
        vert - the flag for the axis
        Returns:
        the minimum component size
      • getPreferredComponentSize

        public int getPreferredComponentSize​(Object component,
                                             boolean vert)
        Returns the preferred size of the specified component in the given axis.
        Specified by:
        getPreferredComponentSize in interface PercentLayoutPlatformAdapter
        Parameters:
        component - the component
        vert - the flag for the axis
        Returns:
        the preferred component size