Before Java 7 the version of Java that worked on the Mac OS X was created and released by Apple. There were several versions of Java for the Mac OS X released.
Java SE 7 Update 4 saw the first version of Java not made by Apple. It was more of a developer preview version as it did not contain all the elements you'd expect from a JDK. There was no JAva plugin or Java Web Start technology. Java SE 7 Update 6 was the first fully fledged version of Java for the Mac OS X from Oracle. This also includes the installation of Java FX SDK and runtime as part of the JDK.
Since Mac OS X Lion (10.7) Java is not pre-installed. This is a nod towards the fact that the version of Java for the Mac OS X is no longer under the stewardship of Apple. What might be confusing is that the Java Preferences application (found under the Utilities folder under Applications) still exists. If you have no version of Java installed and try and open the Java Preferences application you will get the message "To open 'Java Preferences' you need a Java SE 6 runtime. Would you like to install one now?". If you click install then the latest version of Apple's Java 6 will be installed. If you don't need to use Java 6 then there is no need to install this version concurrently with Oracle's Java 7. Java 7 does not use the Java Preferences application - for all intents and purposes going forward this applicaton has been retired.
To download the Java 7 Mac OS X version you can find it on Oracle's Java download page. Just follow the steps of the package to install.
Note: The extra security measures in Mountain Lion might stop you from double-clicking the Java 7 JDK or NetBeans download packages to install them. This is down to the new Gatekeeper feature of the Mac OS X. It's purpose is to stop malicious software from finding it's way on to your Mac. It requires that there is a recognized Apple Developer ID associated with a downloaded application so that it can verify it. You can change the security settings in System Preferences -> Security and Privacy but an easy way is when you know an installer package is from a trusted source you can hold the option key and right-click on the package file and choose open. You'll still get a warning message but it will give you the option to install the package.
Note: If you upgrade your Mac OS X system and you've previously been using Apple's Java 6 version you might find Netbeans has Java 6 as the default JDK. You can change the default platform to be Java 7 by using the Java Preferences application. Go to the Java Preferences application and drag the Java 7 to the top of the list to make it the preferred choice (although if only the Java 7 JRE is installed then it will not appear in the list - there has to be a Java 7 JDK installed for it to appear). When you restart NetBeans you will see Java 7 as the default platform.
The Java 7 JRE creates a link to the Java Control Panel in System Preferences. All the options relating to the Java platform can be tinkered with from there.