Learn how to a build a cloud-first strategyRegister Now


How do I programatically add a component to my GUI?

Posted on 2008-11-04
Medium Priority
Last Modified: 2013-12-14
  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?

Question by:pbenito
  • 2
LVL 60

Expert Comment

by:Kevin Cross
ID: 22882384
What code have you tried so far?

hint: JPanel has an add method.

Post your code attempt and will assist you will refining.
LVL 60

Accepted Solution

Kevin Cross earned 2000 total points
ID: 22882877
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.

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
The viewer will learn how to use NetBeans IDE 8.0 for Windows to connect to a MySQL database. Open Services Panel: Create a new connection using New Connection Wizard: Create a test database called eetutorial: Create a new test tabel called ee…
Suggested Courses
Course of the Month20 days, 17 hours left to enroll

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question