I, as I suspect you also do, use the JavaFX Scene Builder to put together your JavaFX interfaces. There’s certainly still work to be done on Scene Builder but even now I prefer it to any of the GUI builders I’ve used in the past for the principal reason that what you see on the screen is (almost) always exactly what your application will look like.
The other day I put together a quick scene that would capture some basic database settings. Nothing very complex just half a dozen fields that allowed the user to enter username, password etc. This was an internal application so I gave it a once over and kicked it out the door as done. I then got a report back telling me that the tab order was wrong which surprised me as the tab order on everything I’d developed with JavaFX had always just been correct before. I fired up the application and sure enough the tab order was all over the place but consistent.
Here’s a screen shot of the relevant part of the application. The tab order was Username, Host, Port, Database, Vendor, Password which is clearly wrong. I searched around in the Scene Builder for a setting that would allow me to determine tab order but there isn’t an obvious way of selecting the order.
I shut down Scene Builder and opened the FXML file. The fields are held in a GridPane the order of which was the same as the tab order. I moved the password field up to second place and lo and behold the tab order was fixed. I then fired up Scene Builder again and I noticed that the order of the fields had changed. Turns out if you drag and drop the fields in a different order you can change the tab order.
I suppose this makes some sense as there are settings for determining the position of the field in the GridPane but I wonder how I would go about configuring the tab flow of a more complex form. A bit of digging around seems to indicate that, currently, there is no way to control the order of tabbing will take and, as I have found, it is determined by the order of the fields in the FXML. I’ve checked Jira and I can’t find an issue but having said that “tab order” isn’t a very useful search term so I’ll check again later.