These instructions assume you have downloaded a recent version of NetBeans (at this time 8.x), installed and launched it.
Select the Available Plugins Tab
Startup Eclipse and click
Install New Software. You should get this dialog
https://www.codenameone.com/files/eclipse/site.xml for the location to Work with and press Enter.
Download & install IntelliJ/IDEA. Notice that Android Studio will not work.
Install the plugin using The Plugin Center
Use the search functionality in the plugin center to find and install the Codename One plugin.