This is what the API says in the Container add method (well one of the add methods.)
public Component add(Component comp, int index)
Adds the specified component to this container at the given position. This is a convenience method for addImpl(java.awt.Component, java.lang.Object, int).
Note: If a component has been added to a container that has been displayed, validate must be called on that container to display the new component. If multiple components are being added, you can improve efficiency by calling validate only once, after all the components have been added.
Parameters: comp - the component to be added index - the position at which to insert the component, or -1 to append the component to the end Returns: the component comp See Also: addImpl(java.awt.Component, java.lang.Object, int), remove(int), validate(), JComponent.revalidate()
If you look you will find several versions of the add() method, which all function as "convenience" methods, and actually call other methods. You can use add() or getContentPane().add(): both will work. But add() on its own might only work in J5 or later.