aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes Netbeans gui plugin generates main method for all gui classes Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Netbeans gui plugin generates main method for all gui classes" Watch "Netbeans gui plugin generates main method for all gui classes" New topic
Author

Netbeans gui plugin generates main method for all gui classes

Roberto Ramirez
Greenhorn

Joined: Sep 11, 2012
Posts: 3


When I delete main method, class stays the same, there aren't any compiling errors, I want to know why netbeans generates this main method in all my classes, main method has a invokeLater, does this create a new thread for the current class? what if I've got more than one constructor?

Thanks in Advance, I'm really confused
Kemal Sokolovic
Bartender

Joined: Jun 19, 2010
Posts: 825
    
    5

You can look at that generated main method as the one for checking your GUI behavior at runtime. Main method generated by NetBeans GUI builder is there so you can run your class stand-alone, to see and check how each of your GUI classes behaves when run. If that's not the starting point for your application (you have your own main method with code to run the application) you can remove each of those main methods generated by NetBeans without any damaging side effect to your application.


The quieter you are, the more you are able to hear.
Roberto Ramirez
Greenhorn

Joined: Sep 11, 2012
Posts: 3
Kemal Sokolovic wrote:You can look at that generated main method as the one for checking your GUI behavior at runtime. Main method generated by NetBeans GUI builder is there so you can run your class stand-alone, to see and check how each of your GUI classes behaves when run. If that's not the starting point for your application (you have your own main method with code to run the application) you can remove each of those main methods generated by NetBeans without any damaging side effect to your application.


I deleted the main method and pre-visualization of the plugins is still showin my form correctly, I guess I don't need that method anyway, looks like IDE's garbage, since I don't know how it can be usefull to me or where I can check this functionality, I think I'll be erasing them all. Thanks for your answer.
Nam Ha Minh
Ranch Hand

Joined: Oct 31, 2011
Posts: 498

Yes, the generated main() method is not useful, just NetBeans' garbage.


PM Me If You Want to get Urgent Help on Java Programming
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Netbeans gui plugin generates main method for all gui classes