This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Running program in netbeans, no GUI

 
Anthony Schmitt
Ranch Hand
Posts: 37
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 47261
52
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can’t display a JPanel. You have to add it to a frame (or window or applet or dialog).
 
Anthony Schmitt
Ranch Hand
Posts: 37
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ah. So, create a new jFrame and drop the jPanel into the frame?
 
Nam Ha Minh
Ranch Hand
Posts: 502
Eclipse IDE Firefox Browser Windows
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Anthony Schmitt
Ranch Hand
Posts: 37
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 5115
11
Java Netbeans IDE Opera
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
See my reply on the other thread you started.
http://www.coderanch.com/t/568828/GUI/java/Moving-code-netbeans
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic