Best way to create the game window?

I’ve seen a lot of different implementations. For example, this(http://www.java-gaming.org/?action=pastebin&id=143) one creates a JFrame and a Canvas (i don’t know what for) but this (http://zetcode.com/tutorials/javagamestutorial/basics/) one has the main class extend JFrame and then uses JPanels to place all the content on. Are there pros and cons for each method of doing so? Or is one simply better than the other?

Resources for creating Java2D games

Read this to understand the situation with Java2D and gaming with Java in general.

Thanks, i’ll check those out.