Container.add

Container.add

Class Overview | Class Members | This Package | All Packages

Syntax 1
public Component add( Component comp )
Parameters
comp
the component to be added.
Returns
the component argument.
Description
Adds the specified component to the end of this container.



Syntax 2
public Component add( String name, Component comp )
Description
Adds the specified component to this container. It is strongly advised to use the 1.1 method, add(Component, Object), in place of this method.



Syntax 3
public Component add( Component comp, int index )
Parameters
comp
the component to be added.
index
the position at which to insert the component, or -1 to insert the component at the end.
Returns
the component comp
Description
Adds the specified component to this container at the given position.

See Also
remove



Syntax 4
public void add( Component comp, Object constraints )
Parameters
comp
the component to be added
constraints
an object expressing layout contraints for this component
Description
Adds the specified component to the end of this container. Also notifies the layout manager to add the component to this container's layout using the specified constraints object.

See Also
LayoutManager



Syntax 5
public void add( Component comp, Object constraints, int index )
Parameters
comp
the component to be added
constraints
an object expressing layout contraints for this
index
the position in the container's list at which to insert the component. -1 means insert at the end. component
Description
Adds the specified component to this container with the specified constraints at the specified index. Also notifies the layout manager to add the component to the this container's layout using the specified constraints object.

See Also
remove, LayoutManager