Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Java Build a JavaFX Application Graphical User Interfaces Node Types

Why doesn't Java have a WYSIWIG GUI editor like VB or C# so you can just draw graphical elements easily on the screen?

I have read a tiny bit about Swing a few months ago. Seems like FX is more of the same. You have to hand code the placement, size and attributes of UI elements, hearkening back to the days of DOS based application development tools like dBase III and Clipper.

In this day and age, it doesn't make sense (to me) to manually code graphical UI elements. I can't believe that no modern WYSIWYG GUI IDE for Java. If there is one (or more), then the internals of Java FX aren't important to know.

1 Answer

Seth Kroger
Seth Kroger
56,413 Points

It's not mentioned until the end of the course but there is one. JavaFX Scene Builder: http://www.oracle.com/technetwork/java/javase/downloads/javafxscenebuilder-info-2157684.html It will integrate into the IDE. When you edit an .fxml file you may notice two tabs at the bottom, Text and Scene Builder. You can switch between the two views to edit the file if you have Scene Builder installed, just like the graphical and text views for layouts in Android apps.

Craig Dennis
Craig Dennis
Treehouse Teacher

Adiv Abramson , Seth is right, SceneBuilder exists, and I keep it out of focus until the end on purpose. Just like we don't teach DreamWeaver when you learn HTML, SceneBuilder is similar. I want you to understand what it is you are building, before being overwhelmed by the options and knobs of a GUI GUI.

Cameron Raw
Cameron Raw
15,473 Points

Is using the scene builder 'industry standard'? I'm building projects by typing my own FXML but whenever I look up help on doing something within FXML I always get scene builders and standard Java in my Google searches. It's really tough to find an example where someone is explicitly explaining FXML code.

Craig Dennis
Craig Dennis
Treehouse Teacher

HI Cameron!

I think there are a couple of camps. I've seen frustration about the code that the SceneBuilder generates and I've seen people who enjoy that style of development over the autocomplete nature of hand editing your FXML.

I think understanding how FXML works will greatly assist you in using SceneBuilder effectively. I know that if you are working in a group, you will perform code reviews on the FXML as that is what will change even when you use SceneBuilder...as that is the code diff.

FXML was designed for easy understanding to web developers, and I know that the majority of those developers use standard markup over a 3rd party GUI tool.

It's my understanding that the "all in Java" is usually frowned upon on large projects unless everything is written into custom components, which basically makes for smaller more legible code. Otherwise this gets unwieldy pretty fast.

Hope that helps...guess the answer is...it depends :/

Oziel Perez
Oziel Perez
61,321 Points

Craig Dennis , I am one of those who prefer building the xml code from scratch over using GUI tools. However, when I look up anything fxml related on the internet, I find very few answers, mostly leading to the Oracle docs. Their fxml specifications are not very complete, from what I've seen... Are there any books or sites you recommend for learning pure fxml? I'd really like that as I come from a web design background and I could pick it up really fast. Or, as I've heard on one post, should I start off with Scene builder and study the fxml from there if I can't find any good material to study?