Issue
I am using Intellij Idea to create my simple program in javafx that requires SwingFXUtils to convert the image, but I am stuck in this error. I cannot import the SwingFXUtils and I'm trying to add a line of code at module-info.java, but I have no idea what is the right code to put in the module-info.java. What is the right one:
requires javafx....
Please help me. Thank you
Solution
If you are using Maven: add this dependency to your pom.xml and just change the version of your JavaFX version.
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-swing</artifactId>
<version>19</version>
</dependency>
If you are using Gradle: insert this module into the javafx section at build.gradle
modules = ['*****', '*****','javafx.swing']
After that, add this to your module-info.java and your problem should be fixed
requires javafx.swing;
Answered By - Kent
Answer Checked By - Willingham (JavaFixing Volunteer)