If you are using an
IDE, then you'll see that the IDE reports many errors.
Why do you set a GridbagLayout for your frame?
you are (at the end of the program) adding your components like this: component.add(panel). Does that seem right?
And, as Campbeel wrote (although it does not matter much): first make your frame ok, and only then make it visible.
Yiou see: many details that need to be correct. So, code as much as you can, but with the API's at hand, and give the Oracle tutorials a thorough read! There's no other way. But don't worry: it is quite a pleasent way!