Class Container

    • Constructor Detail

      • Container

        public Container()
    • Method Detail

      • add

        public final int add​(Component component)
        Description copied from interface: Sequence
        Adds an item to the sequence.
        Specified by:
        add in interface Sequence<Component>
        Parameters:
        component - The item to be added to the sequence.
        Returns:
        The index at which the item was added, or -1 if the item was not added to the sequence.
      • insert

        public void insert​(Component component,
                           int index)
        Description copied from interface: Sequence
        Inserts an item into the sequence at a specific index.
        Specified by:
        insert in interface Sequence<Component>
        Parameters:
        component - The item to be added to the sequence.
        index - The index at which the item should be inserted. Must be a value between 0 and getLength().
      • update

        @UnsupportedOperation
        public Component update​(int index,
                                Component component)
        Description copied from interface: Sequence
        Updates the item at the given index.
        Specified by:
        update in interface Sequence<Component>
        Parameters:
        index - The index of the item to update.
        component - The item that will replace any existing value at the given index.
        Returns:
        The item that was previously stored at the given index.
      • remove

        public final int remove​(Component component)
        Description copied from interface: Sequence
        Removes the first occurrence of the given item from the sequence.
        Specified by:
        remove in interface Sequence<Component>
        Parameters:
        component - The item to remove.
        Returns:
        The index of the item that was removed, or -1 if the item could not be found.
        See Also:
        Sequence.remove(int, int)
      • remove

        public Sequence<Component> remove​(int index,
                                          int count)
        Description copied from interface: Sequence
        Removes one or more items from the sequence.
        Specified by:
        remove in interface Sequence<Component>
        Parameters:
        index - The starting index to remove.
        count - The number of items to remove, beginning with index.
        Returns:
        A sequence containing the items that were removed.
      • move

        public void move​(int from,
                         int to)
        Moves a component within the component sequence.
        Parameters:
        from - The index where the component is currently located.
        to - The index to move it to.
      • get

        public Component get​(int index)
        Description copied from interface: Sequence
        Retrieves the item at the given index.
        Specified by:
        get in interface Sequence<Component>
        Parameters:
        index - The index of the item to retrieve.
        Returns:
        The item at this index in the sequence.
      • indexOf

        public int indexOf​(Component component)
        Description copied from interface: Sequence
        Returns the index of an item in the sequence.
        Specified by:
        indexOf in interface Sequence<Component>
        Parameters:
        component - The item to locate.
        Returns:
        The index of first occurrence of the item if it exists in the sequence; -1, otherwise.
      • getLength

        public int getLength()
        Description copied from interface: Sequence
        Returns the length of the sequence.
        Specified by:
        getLength in interface Sequence<Component>
        Returns:
        The number of items in the sequence.
      • iterator

        public java.util.Iterator<Component> iterator()
        Specified by:
        iterator in interface java.lang.Iterable<Component>
      • getComponentAt

        public Component getComponentAt​(int x,
                                        int y)
      • getDescendantAt

        public Component getDescendantAt​(int x,
                                         int y)
      • getNamedComponent

        public Component getNamedComponent​(java.lang.String name)
      • setVisible

        public void setVisible​(boolean visible)
        Description copied from class: Component
        Sets the component's visibility.
        Overrides:
        setVisible in class Component
        Parameters:
        visible - true if the component should be painted; false, otherwise.
      • layout

        protected void layout()
        Description copied from class: Component
        Called to lay out the component.
        Overrides:
        layout in class Component
      • paint

        public void paint​(java.awt.Graphics2D graphics)
        Description copied from class: Component
        Paints the component. Delegates to the skin.
        Specified by:
        paint in interface Visual
        Overrides:
        paint in class Component
        Parameters:
        graphics - The graphics context to paint into.
      • isAncestor

        public boolean isAncestor​(Component component)
        Tests if this container is an ancestor of a given component. A container is considered to be its own ancestor.
        Parameters:
        component - The component to test.
        Returns:
        true if this container is an ancestor of component; false otherwise.
      • requestFocus

        public boolean requestFocus()
        Requests that focus be given to this container. If this container is not focusable, this requests that focus be set to the first focusable descendant in this container.
        Overrides:
        requestFocus in class Component
        Returns:
        true if the container or one of its descendants gained the focus or false if no component was found to gain the focus.
      • transferFocus

        public Component transferFocus​(Component component,
                                       FocusTraversalDirection direction)
        Transfers focus to the next focusable component.
        Parameters:
        component - The component from which focus will be transferred.
        direction - The direction in which to transfer focus.
        Returns:
        The newly focused component.
      • getFocusTraversalPolicy

        public FocusTraversalPolicy getFocusTraversalPolicy()
        Returns:
        This container's focus traversal policy.
      • setFocusTraversalPolicy

        public void setFocusTraversalPolicy​(FocusTraversalPolicy focusTraversalPolicy)
        Sets this container's focus traversal policy.
        Parameters:
        focusTraversalPolicy - The focus traversal policy to use with this container.
      • containsFocus

        public boolean containsFocus()
        Tests whether this container is an ancestor of the currently focused component.
        Returns:
        true if a component is focused and this container is an ancestor of the component; false, otherwise.
      • descendantAdded

        protected void descendantAdded​(Component descendant)
      • descendantRemoved

        protected void descendantRemoved​(Component descendant)
      • descendantGainedFocus

        protected void descendantGainedFocus​(Component descendant,
                                             Component previousFocusedComponent)
      • descendantLostFocus

        protected void descendantLostFocus​(Component descendant)
      • load

        public void load​(java.lang.Object context)
        Propagates binding to subcomponents.
        Overrides:
        load in class Component
        Parameters:
        context - The object we're binding to.
      • store

        public void store​(java.lang.Object context)
        Propagates binding to subcomponents.
        Overrides:
        store in class Component
        Parameters:
        context - The object we're binding to.
      • clear

        public void clear()
        Propagates clear operation to subcomponents.
        Overrides:
        clear in class Component
      • mouseMove

        protected boolean mouseMove​(int x,
                                    int y)
        Overrides:
        mouseMove in class Component
      • invalidate

        public void invalidate()
        Description copied from class: Component
        Flags the component's hierarchy as invalid, and clears any cached preferred size.
        Overrides:
        invalidate in class Component
      • repaint

        public void repaint​(int x,
                            int y,
                            int width,
                            int height,
                            boolean immediate)
        Description copied from class: Component
        Flags an area as needing to be repainted.
        Overrides:
        repaint in class Component
        Parameters:
        x - Starting x-coordinate of area to repaint.
        y - Starting y-coordinate.
        width - Width of area to repaint.
        height - Height of area.
        immediate - Whether repaint should be done immediately.
      • getGraphics

        public java.awt.Graphics2D getGraphics()
        Description copied from class: Component
        Creates a graphics context for this component. This graphics context will not be double buffered. In other words, drawing operations on it will operate directly on the video RAM.
        Overrides:
        getGraphics in class Component
        Returns:
        A graphics context for this component, or null if this component is not showing.
        See Also:
        Component.isShowing()
      • isDoubleBuffered

        public boolean isDoubleBuffered()
      • setDoubleBuffered

        public void setDoubleBuffered​(boolean b)
      • assertEventDispatchThread

        protected final void assertEventDispatchThread()
      • assertEventDispatchThread

        public static final void assertEventDispatchThread​(Component component)
      • setEventDispatchThreadChecker

        public static final void setEventDispatchThreadChecker​(Container.EDTChecker checker)