Tip #1: FXML Model Simplification

Today I open a new category of posts, I will try to publish periodically some tips about JRebirth Application Framework.

I begin with a FXML model simplification inspired by @Jerady adm4ee application, I discussed with him about reasons that drive him to use his own small application framework to develop his tool (more info about his tool on bitbucket).

He replies to me that he wants to try coding a whole application without using other external libraries to reduce the number of external dependencies (but the main advantage to use JRebirth is to solve all common threading issues… , by the way I suspect his application to freeze during long task performed into JavaFX Application Thread -[JAT])

So I began to review his code to see which benefits his approach have… and I found a very interesting way to load FXML file. The FXML file is loaded according to the name of his FXMLView class (adm4ee class). This FXMLView is the equivalent of our AbstractFXMLModel.

JRebirth is now providing this convenient feature too (Thanks Jens !).

A sample is available here : Standalone UI demo:

The StandAloneModel will load the Standalone.fxml file and its resource bundle Standalone.properties, then FXMLController (here StandaloneController) will be loaded from the fxml declaration.

So if you want to limit the line to code use the same naming pattern for your Model, FXML & resource bundle.

The model code is now pretty concise 😀

public class StandaloneModel extends DefaultFXMLModel<StandaloneModel> {

     * {@inheritDoc}
    protected void initModel() {
        // Nothing to do yet


JRebirth does all the work in the background !!

For those who don’t know well JRebirth features, the Model layer allows to commuicate with other JRebirth Components and provides some useful method to manage usual threading issues.

Keep coding & don’t hesitate to post your comments


4 thoughts on “Tip #1: FXML Model Simplification

Leave a Reply