How do I programatically add a component to my GUI?

  I create a standard Java Desktop Application in NetBeans 6.1.  I'm trying to add a JButton via code to a JPannel with no success.  How do I add a component to a JPanel?

Who is Participating?
Kevin CrossConnect With a Mentor Chief Technology OfficerCommented:
This may be helpful.

Java Tutorial on Swing/UI Development:

Example of JPanel with components:

As I said above, I will be glad to assist with any questions you have in getting this functioning for you.
Kevin CrossChief Technology OfficerCommented:
What code have you tried so far?

hint: JPanel has an add method.

Post your code attempt and will assist you will refining.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.