Why so many .java files needed for single JavaFX (.fxml) file ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 6

Why so many .java files needed for single JavaFX (.fxml) file ?

I tried to follow some tutorials related to Javafx and found that for single fxml file they relate so many .java files calling the files as Main.java, Main controller.java and and another .java files for small codes. If this is the case for single .fxml, what if the application contains many forms. I just can't imagine the amount of .java files would be there. Compared to Javafx, C# looks neat and easy. Why this complication, Why Oracle couldn't make Java IDE simple. Or Is there a simple way to do this... At least by putting and grouping all the files related to a single .fxml file inside a package. Could that be a better way of doing/organising the files for further usage.

20th Nov 2018, 2:41 AM
ifraz I
ifraz I - avatar
3 Answers
+ 6
I'm not sure which "C#" you are comparing JavaFX to. If you're creating a GUI using C#, the corresponding .xaml files will also be generated in different folders. Even if you can, it wouldn't be nice to condense everything into a single file. Imagine walking into a mall and realize that there's only a single department, so you'll have to pick your outfits in the clothes section right next to where they sell meat. Eww.
20th Nov 2018, 4:53 AM
Hatsy Rei
Hatsy Rei - avatar
+ 5
I guess you can hardcode the GUI yourself. But we all know how hard manual hardcoding is. FXML makes life easy for static objects.
20th Nov 2018, 2:49 AM
👑 Prometheus 🇸🇬
👑 Prometheus 🇸🇬 - avatar
+ 2
Hatsy Rei I was talking about C# GUI Visual Studio. Files and reference are very well organised. All the file related the specific Form are under it and in it similar to a folder. That's what I was mentioning.
20th Nov 2018, 6:53 AM
ifraz I
ifraz I - avatar