Logo

dev-resources.site

for different kinds of informations.

How to Set Up JavaFX in IntelliJ IDEA with Maven

Published at
5/28/2023
Categories
javafx
intellij
maven
Author
javalover
Categories
3 categories in total
javafx
open
intellij
open
maven
open
Author
9 person written this
javalover
open
How to Set Up JavaFX in IntelliJ IDEA with Maven

There are some options to start working with JavaFX to build Graphical User Interface (GUI) using Java programming language. The documentation has explained the JavaFX installation in various code editors, like NetBeans, Eclipse, Visual Studio Code, and IntelliJ IDEA. The easiest one is to set up JavaFX in IntelliJ IDEA with the Maven project because you don't need to download JavaFX SDK or set up the library.

Per this article published, the newest JavaFX version is 20.0.1 and it needs at least Java JDK 17 to install. Make sure the JDK is added to the System Variable Path and set the JAVA_HOME environment variable. You can go to this article to do all that stuff.

  • After Java 17 was installed, open IntelliJ IDEA and click New Project
  • In the left bar (Generators), choose JavaFX
  • Then, specify Name and Folder Location of your project and change Group and Artifact name
  • The most important part is the SDK, make sure you choose the installed Java JDK version, and click Next
  • In the Additional Libraries window, you can select the libraries you want to work with to simplify JavaFX project development, and click Create

Image description

IntelliJ IDEA will download all dependencies needed, so it will take a while. After finishing, the project structure will look like the following image.

Image description

Open pom.xml file, and make sure there are two main dependencies (javafx-controls and javafx-fxml) and one plugin javafx-maven-plugin. In some cases, those dependencies are not the latest version. You can check the latest version in this link for javafx-controls and this link for javafx-fxml.

Image description

Image description

To test and run the application, open HelloApplication.java file, then click the green color play button. It will show the GUI like the following image.

Image description

Congratulation!!! You succeed in creating the first GUI application using JavaFX framework.

javafx Article's
30 articles in total
Favicon
GUI Design with JavaFX Layout Managers
Favicon
Give your app a modern look with FxPopup
Favicon
JavaFX In Action #12 with Steve Hannah about jDeploy, to distribute your Java app as a native bundle
Favicon
JavaFX In Action #11 with Almas Baim about FXGL, a multipurpose game library for JavaFX
Favicon
JavaFX In Action #10 with Clément de Tastes about QuarkusFX, combining the strengths of Quarkus and JavaFX
Favicon
OSD Final Chapter: Part 3
Favicon
OSD Final Chapter: Part 2
Favicon
JavaFX In Action #8 with Ulas Ergin: How JavaFX helps to migrate from Swing to React UIs, all combined in one Java app
Favicon
Desktop E-commerce Application
Favicon
JavaFX Dock project
Favicon
JavaFX In Action with Daniel Zimmermann about JavaFX and Kotlin
Favicon
JavaFX In Action with Pedro Duque Vieira, aka Duke, about Hero, PDFSam, FXThemes, FXComponents,...
Favicon
JavaFX In Action with Christopher Schnick about XPipe, an app to manage all your servers
Favicon
JavaFX In Action with Robert Ladstätter about LogoRRR, a cross-platform log analysis tool
Favicon
Devlog - Creating a MVCI JavaFX Application
Favicon
Book review - Frontend Development with JavaFX and Kotlin
Favicon
Search in Documentation with a JavaFX ChatGPT-like LangChain4j Application
Favicon
How to assign shortcut to a button in fxml
Favicon
A JavaFX Game Application in a Single Java File with JBang and FXGL
Favicon
How to Create an Executable .jar file for JavaFX using Maven
Favicon
How to use the JavaFX library Medusa to display weather data
Favicon
JavaFX en Eclipse
Favicon
JFxBorderlessNative provide Windows Native Aero Snap support for UNDECORATED view in JavaFx
Favicon
How to Set Up JavaFX in IntelliJ IDEA with Maven
Favicon
Arabic Text Rendering Issues in JavaFX
Favicon
Hide JavaFX FXML Warnings in IntelliJ IDEA
Favicon
Using Sass in your JavaFX project
Favicon
Animating using sliders in JavaFX and SceneBuilder
Favicon
Multithreading example with video play by JavaFx
Favicon
Idaesbasic - An all in one project manager

Featured ones: