Apparently JavaFX is getting really into the game now as far as I see and I think its time I start getting to know it .. Just read a couple of articles and a few questions came up in my mind:
- Do I need to use IDE (eclipse) for javafx projects or text editor?
- If I have already existing project can I add the GUI afterwards as I'd do with swing after the logic is working?
- Any articles/tutorials are more than welcome if you know any

Thanks in advance!

2 Years
Discussion Span
Last Post by Doogledude123

You don't need an IDE, but if you are going to use one NetBeans seems to have integrated it better. JavaFX comes with a drag'n'drop GUI builder called SceneBuilder that you can use stand-alone or in your IDE.

Yes, you can (probably should!) add the GUI to the logic layer rather than v.v. However, compared to Swing you have a properties and binding mechanism based on Observables that your logic layer can (should?) implement to provide GUI support, rather than Swing's addListener(...) approach.

I've played with it, no real projects yet, and there's a significant learning "hump" to get over if you're coming from Swing. I'm yet to be convinced that it offers any real advantage over Swing for ordinary business-type GUIs. However, for more graphic animated consumer-oriented work it's miles ahead.

DoogleDude123 has been getting into JavaFX, so I'm sure he can contribute a lot to this discussion.

Edited by JamesCherrill

Votes + Comments

Great answer James, I ll keep it unsolved and maybe get some more inputs by other users for a few days, Thanks!


Hey Slavi, glad to see some interest in Java FX. I definitely think Java FX is excelling now and will soon become a primary over swing.

If you're looking into getting into it, I would suggest building a simple GUI Program (Anything you want), inside of the SceneBuilder (What JC was talking about), and adding a Controller Class to the GUI to do program the logic. You can grab SceneBuilder from the JDK 8 Extra Downloads page.

Use an FXMLLoader to load your GUI.
FXMLLoader loader = new FXMLLoader(MainClass.class.getResource("path/to/fxml/gui.fxml"));

For programming the controller, don't forget to set the fx:id under the code menu on the right side in SceneBuilder, and then go ahead and grab the Sample Controller Skeleton from View > Show Sample Controller Skeleton. Make sure full is checked then just copy-paste that into an empty class file.

Link your new Controller by calling it in loader.setController(new GUIControllerClass());

Of course this isn't all you need, google around for diferent things, like a basic tutorial, this should be a good start however. Come back if you have questions.

Votes + Comments
Excellent input. Thansk you.

ps Forgot to mention media support. At last we can bury the old Java media framework in the dungheap of history where it belongs. I use FX's MP3 player even in Swing apps because (a) it's trivially easy and (b) it works...

    static MediaPlayer withFile(File file) {  // factory method
        // force JFX environment initialisation if necessary...
        // API doc for javafx.embed.swing.JFXPanel constructor says: 
        // Implementation note: when the first JFXPanel object is created, 
        // it implicitly initializes the JavaFX runtime. 
        // This is the preferred way to initialize JavaFX in Swing.
        new javafx.embed.swing.JFXPanel();
        // now we need a string representation of the URI of our media...
        String source = file.toURI().toString();
        // ... to create a Media object and a player to play it
        return new MediaPlayer(new Media(source));

    // Control the MediaPlayer with play(), pause(), stop(), dispose()
    // query media metadata etc - see API doc for MediaPlayer and Media

Edited by JamesCherrill


Great, thanks guys!
@Doogle, do you use IDE (if so which?) or text editor? I am considering to get netBeans just for these apps, might be a bit hard to begin straight on editor

-For future interested in javaFX readers, I found people recomending this article

Edited by Slavi


That tutorial looks good, but surely if anyone is learning JavaFX now they should be using the Java 8 version of it. There are very significant improvements, eg Properties, that change how you use JavaFX.


Hmm this is really weird, had Luna installed but it didn't have plugins for it however, if you get it from Click Here
It comes with inbuilt things?


Eclipse works fine :P I have since switched to IntelliJ IDEA community edition. It doesn't matter what you use for it. Update your JDK to Java 8, JavaFX is built in now.

Stick with the SceneBuilder for a while, then program your own GUI through code.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.