Java/Netbeans question

Ur_Mom

Fully [H]
Joined
May 15, 2006
Messages
20,701
I am taking a programming class where I have to use Java. I can do the code just fine for the program, but we need to design a GUI for it. I am using NetBeans and creating the GUI using the designer, which turns out fine. I can preview it and it looks fine. But, it doesn't create the GUI within the source code as it should. I have looked at tutorials, and the designer automatically creates the code for the placement of the various components. I feel I'm missing something simple.

I can design my GUI fine. I can change the button behavior (for closing the application, using System.exit(0); ), which would work. But, when editing source or building the application, it doesn't show any of the buttons or text that I added in the design view.

Any ideas? I've even tried very simple "Hello World" with no luck. Just the very basic stuff.... :/

Nevermind, I found the code (Generated Code, hidden until you click it). But, it won't run the application. I can download a similar one and it runs fine. No errors or anything... :/

I can run any package I download. But, if I create my own, it doesn't run. It compiles with no errors, but it won't run... I've even made the most basic one I can and it doesn't work....

EDIT - Found the problem. For future people having same issue - Under project properties > Run - Change the main class to your main jSwing class. Otherwise, it just runs and stops the first class... Easy, but also easily overlooked. :)
 
Last edited:
Back
Top