I used the design palette in Apache Netbeans to design a gui application. I have modified much of the code to suit my needs but some remains pure copy and paste. Am I allowed to use the autogenerated code in a commercial application? If yes, do I need to disclose something in the source code or how does it work?
Often, the automatically generated code is your code, because you designed the design (which is often saved as xml or other anyway), and the program converted it into code, i.e. it was a converter.
It is not clear, it depends on the specific case, but even if it is copyrighted by Apache Netbeans, Netbeans is licensed under the Apache 2.0 license which is permissive.
Assuming such a case, what you need to do is meet the basic credit requirements. Of course, if you want to be very correct, it will take some space (note, license, authors, description of changes), but it will not affect your product with any copyleft or non-commercial terms.
Read about Apache 2.0 License here.
THIS IS NOT LEGAL ADVICE