Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Netbeans gui plugin generates main method for all gui classes

 
Roberto Ramirez
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


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
Posts: 825
5
Java Python Ruby
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Roberto Ramirez
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 504
Eclipse IDE Firefox Browser Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, the generated main() method is not useful, just NetBeans' garbage.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic