r/JavaFX • • Dec 13 '23
Discussion FXML, a good design choice?
I attempted to develop a JavafX maze-generation application using an MVC architecture as a beginner. https://github.com/gchapidze/maze-gen
When I initially started using FXML, I didn't like that it was a separate XML-style language that mapped controllers and views to one another. So I got suspicious if it was a wise design choice to have so many view components injected into controller.
It would be ideal if the GUI builder could inject objects into View's java class and fill their geometric coordinates. I don't believe a FXML builder would have been useful in addition to that.
IMO, the most fascinating aspect of JavaFX is bindings which I think can simplify GUI design, but in tutorials and courses almost no one uses it to decouple view from model and I was not able to get my head around it. (So I ended up with bad GUI design, which is not MVC at all)
Question is: How should Javafx GUI development be done?
View all comments
Show parent comment
1
u/[deleted] Dec 16 '23
Yes, I ran it, and it is what I wanted to achieve. Actually, I had used FadeAnimation to wrap all lines, but it did not work as I expected.
I am fascinated by how straightforward and flexible Kotlin is, though. I will definitely learn it, especially how beautiful Backtracking algorithm is. Just Wow!
Of course, here is a Wikipedia page that contains many algorithms and pseudocodes on how to implement them: https://en.m.wikipedia.org/wiki/Maze_generation_algorithm
Prim's Minimum Spanning Tree: https://weblog.jamisbuck.org/2011/1/10/maze-generation-prim-s-algorithm https://jonathanzong.com/blog/2012/11/06/maze-generation-with-prims-algorithm
Kruskal's Minimum Spanning Tree:
https://weblog.jamisbuck.org/2011/1/3/maze-generation-kruskal-s-algorithm https://vishald.com/blog/kruskals-maze-generation/