The NetBeans source code is available under the Common Development and Distribution License (CDDL) v1.0 and the GNU General Public License (GPL) v2. The source code is available in a Mercurial repository. All development of NetBeans happens using the Mercurial server on this site, and development proposals and decisions happen on the public mailing lists.
You can get to the sources in several ways.
If you are interested in making a build from the sources, see the Working with the NetBeans Sources pages.
For legacy products and historical reasons, you can also browse the old CVS repository.
What is available here is the entire source tree and history of the NetBeans IDE. Generally, there is a "stable" branch and a "development branch." The development branch is where ongoing development happens - it will be more or less stable depending on what point in the release cycle it is.
For a a description of the physical organization of the sources in the Mercurial repository, see Mercurial Repositories.