1

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?

3
  • 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. Commented Jun 1, 2013 at 15:49
  • @scottb what solution can you propose? Commented 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. Commented Jun 1, 2013 at 18:05

2 Answers 2

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.

Sign up to request clarification or add additional context in comments.

2 Comments

Thank you for the reply. Is there a tool for creating Visual JavaFX application similar SceneBuilder but generating pure Java code?
Like Swing matisse ? I never heart of such a thing in javafx.
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.

2 Comments

interesting. Visage looks like it has not had any activity since 2011. Are you using this? Is the project still alive?
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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.