How do I programatically add a component to my GUI?

Hi,
 
  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?

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

Java Tutorial on Swing/UI Development:
http://java.sun.com/docs/books/tutorial/uiswing/

Example of JPanel with components:
http://java.sun.com/docs/books/tutorial/uiswing/components/toplevel.html

As I said above, I will be glad to assist with any questions you have in getting this functioning for you.
0
 
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.
0
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.