JPanel or Canvas?

I have not been programming for too long to know or understand how different java classes is doing when it comes to performance…

This might be a normal question, I did search the forum but didnt find an answear to it.
Which is best to use: JFrame or Canvas?
What are the Pros and Cons with each?

And also something that came to mind right now while typing:
Updating graphics on for example JPanel… Then you call the paintComponent method… But that method takes a Graphics g in its parameters… What is the correct way of calling it from for example a game loop? Should i just create an empty Graphics object on the game initialization and use that or should i actualy declare the object to something?

JPanel uses Swing. Ancient, but newer.

Canvas is AWT which is long dead.

Pick JPanel - it’s lighweight. Canvas is heavy height.

Take a look at JavaFX otherwise.

How about update methods when it comes to swing components like JFrame and JPanel?
When i run my application just to test the library im making it seems like they are updating themselves autoamtically…
Are they?

If you are looking for performance you should be looking at OpenGL based rendering.

If you decide to stick with Java2D (IMHO a poor choice), then usually Canvas and buffer strategy is how you might write a game loop.