File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Swing / AWT / SWT and the fly likes Running program in netbeans, no GUI Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Running program in netbeans, no GUI" Watch "Running program in netbeans, no GUI" New topic
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: 36486
    
  16
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: 484

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.


PM Me If You Want to get Urgent Help on Java Programming
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: 4523
    
    5

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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Running program in netbeans, no GUI
 
Similar Threads
Netbeans 7.0.1 questions
if statement problem
Dout in Around Advice
Casting between classes.
Unable to display the UI