You can either download JavaFX from the official Oracle website or install JavaFX from the default Ubuntu repositories.
Oracle JavaFX
As of JDK 7u6 JavaFX is included with the standard JDK and JRE bundles. Please download the JDK or JRE to use JavaFX. Oracle Java Installation instructions are at this question: How can I install Sun/Oracle's proprietary Java JDK 6/7/8 or JRE?.
On the same Oracle Java download page there is another link to download a Java SE Development Kit (JDK) Cobundle which contains JDK 8 with NetBeans IDE.
Ubuntu JavaFX
In the Ubuntu 16.04 and later default repositories JavaFX is packaged as a separate package named openjfx. To install it, open the terminal and type:
sudo apt install default-jdk openjfx
This command is a complete alternative to installing Oracle Java and JavaFX. Optionally you can install openjdk-11-jdk instead of or alongside openjdk-8-jdk in Ubuntu 18.04, and openjfx works with both JDKs.
You can also install NetBeans with this command:
sudo apt install netbeans
JavaFX can run all the JavaFX examples from the "Getting Started with JavaFX" tutorials at the official Oracle website successfully. The only difference from the Oracle tutorials is that in NetBeans openjfx doesn't add a JavaFX Application entry in the File -> New Project -> Java category, so you need to select Java Application instead.