Installing IntelliJ with JavaFX

 

Install IntelliJ

  1. Download IntelliJ community version from their website. Direct Link

  2. Run the installer
    Capture.PNG

  3. Choose installation location. Default is C and that is ok. Wait until the installation in complete. Reboot the PC

  4. Run intelliJ, Choose Dark Theme.
    Capture6.PNG

  5. Disable all plugins.
    Capture8.PNG

  6. Create new project
    Capture9.PNG

  7. Choose Java and uncheck groovy & kotlin
    Capture10.PNG

  8. Select create project from template
    Capture11.PNG

  9. Define project name, location and click finish.
    Capture12.PNG

  10. You will see the following pre-created code
    Capture13.PNG

  11. On the Left side click project and project structure will be visible in a panel
    Capture14.PNG

Customize intelliJ

To Install Plugins go to file -> settings -> plugins.

Syntax Highlight

Type and install Monokai pro
Capture15.PNG

Colorful Brackets

Rainbow Brackets
Capture16.PNG

Highligh Brackets

Highlight Brackets
Capture19.PNG

Code AutoCompletion

Kite
Capture17.PNG

Restart IntelliJ to activate these plugins

Capture18.PNG

Configure JavaFX

Download JavaFX library

  1. Download JafaFX Library version 15.0.1 from here. Direct Link

  2. Unzip it into c:\ in Windows or /home/user_name/ in Linux

Create FX project

  1. Create new project select javafx. Capture1.PNG
  2. Choose name and location Capture2.PNG
  3. Demo code will be generated Capture3.PNG

Add Fx library

  1. You will notice intelij cannot find the javafx library (red underline). We have to add fx library. Go to file -> project structure and select library Capture4.PNG

  2. Locate the lib folder inside javafx folder extracted in c: or /home/user_name/ earlier. Capture5.PNG

  3. Go to run -> edit configuration add the following code in VM options.

    For Windows:

    --module-path C:\javafx-sdk-15.0.1\lib --add-modules javafx.controls,javafx.fxml --add-exports javafx.graphics/com.sun.javafx.sg.prism=ALL-UNNAMED
    

    For Linux:

    --module-path /home/user_name/javafx-sdk-15.0.1/lib --add-modules javafx.controls,javafx.fxml --add-exports javafx.graphics/com.sun.javafx.sg.prism=ALL-UNNAMED
    

    Press apply and ok. intellij_vm_options.PNG

  4. Now run the code by pressig play button and you will see a window!!! intellij_javafx_window.PNG

Configure Scenebuilder

Download Gluon ScenBuilder from here install it and set the installed path into file ->settings-> JAVA FX

For Windows:

C:\Program Files\SceneBuilder\SceneBuilder.exe

For Linux

/opt/SceneBuilder-11/SceneBuilder

intellij_scenebuilder.PNG

Right click on fxml file and open with scenebuilder. intellij_scenebuilder_open_with.PNG