The source code for NetBeans itself is available under the Common Development and Distribution License (CDDL) v1.0 and GNU General Public License (GPL) v2.
It's possible to obtain the source for NetBeans either as a
.zip file, containing the entire source for a specific release, by cloning the code from the NetBeans Mercurial repository or by viewing the files from within a browser.
If you just want to look at the NetBeans source code and aren't interested in making changes, you can download the source as a
.zip archive from the relevant download page for any release. At the bottom of each download page, there is a link to download the source in the ZIP file ...