| Author |
Running program in netbeans, no GUI
|
Anthony Schmitt
Ranch Hand
Joined: Nov 17, 2009
Posts: 37
|
|
I have two files, SwitchOverlay.java and HUD.java. SwitchOverlay is the following:
Hud.java is a jPanel. When I compile and run everything builds successfully but I get no window popping up for me to test out the program.
When I try to run at first it'd say that switchoverlay.HUD doesn't have a main method.
Any ideas? Why don't I see my window when I run this?
|
 |
Campbell Ritchie
Sheriff
Joined: Oct 13, 2005
Posts: 32830
|
|
|
You can’t display a JPanel. You have to add it to a frame (or window or applet or dialog).
|
 |
Anthony Schmitt
Ranch Hand
Joined: Nov 17, 2009
Posts: 37
|
|
|
Ah. So, create a new jFrame and drop the jPanel into the frame?
|
 |
Nam Ha Minh
Ranch Hand
Joined: Oct 31, 2011
Posts: 364
|
|
Anthony Schmitt wrote:Ah. So, create a new jFrame and drop the jPanel into the frame?
Yes, as JPanel is a container and JFrame is a window.
|
Job Offer: Online working Java technical writing
|
 |
Anthony Schmitt
Ranch Hand
Joined: Nov 17, 2009
Posts: 37
|
|
|
OK, new question. Is there a way to disable project files, and can I delete automatically generated code, such as a radio button action that doesn't need to be there? I tried deleting some code for it and lost my whole jFrame! Brought back the graphical components using history but all the code is missing now.
|
 |
Darryl Burke
Bartender
Joined: May 03, 2008
Posts: 4202
|
|
See my reply on the other thread you started.
http://www.coderanch.com/t/568828/GUI/java/Moving-code-netbeans
|
luck, db
There are no new questions, but there may be new answers.
|
 |
 |
|
|
subject: Running program in netbeans, no GUI
|
|
|