Is there a difference between them and are there any conditions in which one should be used instead of the other?
Both calls are the same. In Java 5, they changed jframe.add
to forward calls to the content pane.
From the Java 5 release notes:
Lastly, after seven years, we've made jFrame.add equivalent to jFrame.getContentPane().add().
Also, see the javadocs.