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?
-
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– scottb2013-06-01 15:49:26 +00:00Commented Jun 1, 2013 at 15:49
-
@scottb what solution can you propose?Peter Penzov– Peter Penzov2013-06-01 17:10:33 +00:00Commented Jun 1, 2013 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– scottb2013-06-01 18:05:11 +00:00Commented Jun 1, 2013 at 18:05
2 Answers
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.
2 Comments
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.