I'm interested can I use pure JavaFX API instead FXML for modeling the user interface. Also if I create FXML GUI with SceneBuilder can I convert the XML code into pure Java code?
Asked
Active
Viewed 809 times
1
-
I'd wonder why you would want to do such a thing. GUI code, in general, and JavaFX code, in particular, is verbose, wordy, and ugly to look at. In my mind, the chief benefit of FXML is that it enables to you clear out the wordy JavaFX code of your application. There are other benefits too. FXML enables you to edit your GUI without mandating that you recompile your application for many kinds of changes. I'd advise that you learn to use FXML with JavaFX for all these benefits. – scottb Jun 01 '13 at 15:49
-
@scottb what solution can you propose? – Peter Penzov Jun 01 '13 at 17:10
-
For my part, I use Scene Builder to create the templates for my GUI's. I am not inclined to try and do anything very fancy at all with FXML. No scripting, etc. I use it to create the skeleton for my GUI which cuts out a huge volume of otherwise very ugly JavaFX code from my controller classes. Then I dynamically manipulate the controls of interest within the code of my controller class. I think that this is what most people do with FXML. FXML is far more powerful than the way in which I use it, but I just want all the ugly, noisy, unsightly JavaFX code out of my controller classes. – scottb Jun 01 '13 at 18:05
2 Answers
5
can I use pure JavaFX API instead FXML for modeling the user interface.
Yes, this is (was) the classic way to build user interfaces in JavaFX 2.0
.
can I convert the XML code into pure Java code?
Currently (as I know), there is no automatic way to generate Java
code from an FXML
document.

Salah Eddine Taouririt
- 24,925
- 20
- 60
- 96
-
Thank you for the reply. Is there a tool for creating Visual JavaFX application similar SceneBuilder but generating pure Java code? – Peter Penzov Jun 01 '13 at 15:22
-
Like Swing matisse ? I never heart of such a thing in javafx. – Salah Eddine Taouririt Jun 01 '13 at 15:26
1
Just like the other answer, if you check around official Java FX tutorials, they code every GUI stuff in applications by pure code.
Why do you want to use pure Java API? If you use FXML and so Controller classes, you can obtain nice MVC based applications.
I think you should check around Visage. It's declarative code for GUI apps. And yes, I agree that project's been left unattended since 2011.

diegoaguilar
- 8,179
- 14
- 80
- 129
-
interesting. Visage looks like it has not had any activity since 2011. Are you using this? Is the project still alive? – chooks Nov 22 '13 at 11:50
-
That's an issue, right. I'm not exactly using it. I think is great it's compatibility with not only Java FX but Groovy and Grails. – diegoaguilar Nov 22 '13 at 16:33