• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Netbeans gui plugin generates main method for all gui classes

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Bartender
Posts: 825
5
Python Ruby Java
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 530
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes, the generated main() method is not useful, just NetBeans' garbage.
 
It is difficult to free fools from the chains they revere - Voltaire. tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic