I just realized something, I don't think anyone specifically answered your questions directly. I think it is mostly because Java is a programming language... not a game maker. In other words, those components (like JFrame, JComponent, etc.) just puts a frame into the screen while you, the coder, has to provide the artwork and logic.
Would you please explain which is the "best" solution for developing games (and why)? 2d games specifically.
I think you may be asking the wrong question as... all of these play a part in getting a basic screen to show. There is no technical "best" solution, though double-buffering does help a lot with animation. In other words, whichever one helps you get a screen that you can design on the fastest would probably be the best.
Do you choose one of these classes depending on what kind of game your going to make?
If you are using Java2D, you will be using one of these to create your game. None of these are better than the other solution as they are not based on speed. Some have double buffering which helps you during animations, but that is about as much as you'll get from a frame. You can also control screen-size with it, but you have to be careful as some of the Swing components scale your work while others do not. Research through Google or follow your tutorials closely.
All tutorials that I have read have only been 2D so far. I have read it is important to learn 2D concepts and programming techniques before moving on to 3D. Also I have been learning swing from one of my books, but is it necessary to learn this if I am mainly going to write my own ui components? Should I still learn swing regardless?
This highly depends on what you are coding for...
If you are in it strictly to make games, I'd say just find the first solution and go with that.
If you are in it to learn more about Java in general, then by all means, learn Swing.
Writing your own UI components is fine. I usually don't like the layouts that Swing gives to me by default anyway because I find them too limiting. Keep in mind that rolling your own components will ultimately take you longer to actually produce something. Keep in mind any of these solutions are fine to use, and it won't affect performance for your 2D game...
Oh, and I generalized a lot in this post because they were very technical in the posts above. So, if I were you, I'd pick my favorite tutorial and start coding. There is a lot more to game making than just the screen to use. You still have to look at game loops, animation, sound, controls, etc.