This is how to solve it.
In pom.xml, check your javafx version. I have an issue when it was version 21. It was fixed by changing it into 21.0.2 (just type it in), go to Maven tab and reload all Maven projects (right next to the download button). See if it works or not.