Closed RezwanAhmed123 closed 22 hours ago
@RezwanAhmed123 If any of these were caused by a gap/flaw in our JavaFX tutorial, or if you have any suggestions to improve it, let us know. The tutorial was revamped since the last semester, and has not been battle-tested until now.
@damithc hi prof, i think the scenebuilder part of tutorial 4 could have been improved because I noticed when scenebuilder modifies your .fxml file, the javafx version is changed to like 22 which causes a warning to flash every time you run the app and pass in a command.
Agreed, I was confused on why the version kept giving me an error. Thanks for these tips! 💯
Make sure to only use .png files for pictures.
I do not think it's limited to .png only? I'm working fine with a .jpg file! I know .webm files don't work though. There's a list in this StackOverflow post about formats that might be useful!
@zaidansani i apologise for that, I only used .webm and .webp files thus I didn’t know about .jpg files.
@damithc hi prof, i think the scenebuilder part of tutorial 4 could have been improved because I noticed when scenebuilder modifies your .fxml file, the javafx version is changed to like 22 which causes a warning to flash every time you run the app and pass in a command.
@RezwanAhmed123 I've added a note about this in https://se-education.org/guides/tutorials/javaFxPart4.html#using-scene-builder-to-tweak-the-gui Is that a good-enough solution for this issue?
1. I forgot to add javafx.fxml to the javafx inside of build.gradle like below so they couldn't really recognise fxml files at first. The corrected version is:
javafx { version = "17.0.7" modules = [ 'javafx.controls', 'javafx.fxml'] }
Is this needed? I don't think we mention this in the JavaFX tutorial, and we don't have it in AB3 either.
@damithc hi prof, regarding this:
Is this needed? I don't think we mention this in the JavaFX tutorial, and we don't have it in AB3 either.
I was having issues running the app without the javafx.fxml because gradle was not recognising the .fxml files for some reason. After I added it, I was working fine.
About the new note, yeah it seems good!
@damithc hi prof, regarding this:
Is this needed? I don't think we mention this in the JavaFX tutorial, and we don't have it in AB3 either.
I was having issues running the app without the javafx.fxml because gradle was not recognising the .fxml files for some reason. After I added it, I was working fine.
About the new note, yeah it seems good!
I believe it's because of this line
id 'org.openjfx.javafxplugin' version '0.1.0'
If you remove this line, you do not need to specify the javafx modules used like this.
However, instead you'll need to list each module's source in the dependency block (ie the win mac linux
for the base, graphics, etc...)
Not sure what's the difference but they give the same result
Not sure what's the difference but they give the same result
@yadobler Thanks for looking into this. One hypothesis (needs to be verified) is that listing the JavaFX dependencies for the three OS'es explicitly will ensure they are all added to the jar file (thus making the jar file runnable on all three) while the other approach will only include the ones needed for the current OS.
This is a non exhaustive list of issues I faced while setting up javafx to project:
Make sure to only use .png files for pictures.
Make sure to use the correct name/path for the image file in the MainWindow folder
Never change the mainClass to the appropriate one after adding the Launcher file. Corrected version:
inside the .fxml files and changed it to 17.0.7 (used to be like 22 or something)