Interface Container

    • Method Detail

      • size

        int size()
        Returns:
        The number of child components in this composite component.
      • isEmpty

        boolean isEmpty()
        Returns:
        Whether this container contains no child components.
      • contains

        boolean contains​(java.lang.Object component)
        Determines whether this container contains the given component.
        Parameters:
        component - The component to check.
        Returns:
        true if this container contains the given component.
      • indexOf

        int indexOf​(java.lang.Object component)
        Returns the index in the container of the first occurrence of the specified component.
        Parameters:
        component - The component the index of which should be returned.
        Returns:
        The index in this container of the first occurrence of the specified component, or -1 if this container does not contain the given component.
      • lastIndexOf

        int lastIndexOf​(java.lang.Object component)
        Returns the index in this container of the last occurrence of the specified compoent.
        Parameters:
        component - The component the last index of which should be returned.
        Returns:
        The index in this container of the last occurrence of the specified component, or -1 if this container does not contain the given component.
      • get

        Component get​(int index)
        Returns the component at the specified index in the container.
        Parameters:
        index - The index of component to return.
        Returns:
        The component at the specified position in this container.
        Throws:
        java.lang.IndexOutOfBoundsException - if the index is out of range.
      • add

        boolean add​(Component component)
        Adds a component with default constraints to the container.
        Parameters:
        component - The component to add to this container.
        Returns:
        true if this container changed as a result of the operation.
        Throws:
        java.lang.IllegalArgumentException - if the component already has a parent.
        java.lang.IllegalStateException - if the installed layout does not support default constraints.
      • add

        void add​(int index,
                 Component component,
                 Constraints constraints)
        Adds a component along with constraints to the container at the specified index. This is a convenience method that first sets the constraints of the component.
        Parameters:
        index - The index at which the component should be added.
        component - The component to add to this container.
        constraints - The constraints for the layout, or null if default constraints should be used.
        Throws:
        java.lang.IllegalArgumentException - if the component already has a parent.
        java.lang.ClassCastException - if the provided constraints are not appropriate for the installed layout.
        java.lang.IllegalStateException - if no constraints were provided and the installed layout does not support default constraints.
        java.lang.IndexOutOfBoundsException - if the index is less than zero or greater than the number of child components.
      • add

        boolean add​(Component component,
                    Constraints constraints)
        Adds a component along with constraints to the container. This is a convenience method that first sets the constraints of the component.
        Parameters:
        component - The component to add to this container.
        constraints - The constraints for the layout, or null if default constraints should be used.
        Returns:
        true if this container changed as a result of the operation.
        Throws:
        java.lang.IllegalArgumentException - if the component already has a parent.
        java.lang.ClassCastException - if the provided constraints are not appropriate for the installed layout.
        java.lang.IllegalStateException - if no constraints were provided and the installed layout does not support default constraints.
      • add

        Component add​(int index,
                      Prototype prototype)
        Adds a component based upon the given prototype to the container with default constraints at the specified index.
        Parameters:
        index - The index at which the component should be added.
        prototype - The prototype of the component to add.
        Returns:
        The component created to represent the given prototype.
        Throws:
        java.lang.IllegalArgumentException - if no component can be created from the given prototype
        java.lang.IllegalStateException - if the installed layout does not support default constraints.
        java.lang.IndexOutOfBoundsException - if the index is less than zero or greater than the number of child components.
        See Also:
        AbstractContainer.createComponent(Prototype)
      • add

        Component add​(Prototype prototype)
        Adds a component based upon the given prototype to the container with default constraints.
        Parameters:
        prototype - The prototype of the component to add.
        Returns:
        The component created to represent the given prototype.
        Throws:
        java.lang.IllegalArgumentException - if no component can be created from the given prototype
        java.lang.IllegalStateException - if the installed layout does not support default constraints.
        See Also:
        AbstractContainer.createComponent(Prototype)
      • add

        Component add​(int index,
                      Prototype prototype,
                      Constraints constraints)
        Adds a component based upon the given prototype to the container along with constraints at the specified index.
        Parameters:
        index - The index at which the component should be added.
        prototype - The prototype of the component to add.
        constraints - The constraints for the layout, or null if default constraints should be used.
        Returns:
        The component created to represent the given prototype.
        Throws:
        java.lang.IllegalArgumentException - if no component can be created from the given prototype
        java.lang.ClassCastException - if the provided constraints are not appropriate for the installed layout.
        java.lang.IllegalStateException - if no constraints were provided and the installed layout does not support default constraints.
        java.lang.IndexOutOfBoundsException - if the index is less than zero or greater than the number of child components.
        See Also:
        AbstractContainer.createComponent(Prototype)
      • add

        Component add​(Prototype prototype,
                      Constraints constraints)
        Adds a component based upon the given prototype to the container along with constraints.
        Parameters:
        prototype - The prototype of the component to add.
        constraints - The constraints for the layout, or null if default constraints should be used.
        Returns:
        The component created to represent the given prototype.
        Throws:
        java.lang.IllegalArgumentException - if no component can be created from the given prototype
        java.lang.ClassCastException - if the provided constraints are not appropriate for the installed layout.
        java.lang.IllegalStateException - if no constraints were provided and the installed layout does not support default constraints.
      • remove

        boolean remove​(java.lang.Object component)
        Removes a component from the container.
        Parameters:
        component - The component to remove.
        Returns:
        true if this collection changed as a result of the operation.
        Throws:
        java.lang.ClassCastException - if given element is not a component.
        java.lang.IllegalArgumentException - if the component is not a member of the container.
      • remove

        Component remove​(int index)
        Removes the child component at the specified position in this container.
        Parameters:
        index - The index of the component to removed.
        Returns:
        The value previously at the specified position.
        Throws:
        java.lang.IndexOutOfBoundsException - if the index is out of range (index < 0 || index >= size()).
      • clear

        void clear()
        Removes all of the components from this container.
      • setLayout

        <T extends Constraints> void setLayout​(Layout<T> newLayout)
        Sets the layout definition for the container. The layout definition can only be changed if the container currently has no child components. This is a bound property.
        Type Parameters:
        T - The type of the constraints.
        Parameters:
        newLayout - The new layout definition for the container.
        Throws:
        java.lang.NullPointerException - if the given layout is null.
        java.lang.IllegalStateException - if a new layout is requested while this container has one or more children.
        See Also:
        LayoutComponent.LAYOUT_PROPERTY