You are here: HomeComputingJavaFXControlling Tab Order in JavaFX2

Controlling Tab Order in JavaFX2

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.

PersistenceConfigurationHere'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.

PersistenceConfiguration2I 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.

Add comment

All comments are moderated. Commercial / spam comments are always removed.

Security code
Refresh

Follow Me...

Share this post

Latest Comments

  • Editing Null Data Values in a Cell with JavaFX 2

    Guest
    I liked Harald K's suggestion, but I had to change it to: super.updateItem(item, empty && (getTableRow() ...

    Read more...

     
  • Editing Null Data Values in a Cell with JavaFX 2

    Guest
    This was driving me absolutely crazy! Makes perfect sense now that it's been explained, of course...

    Read more...

     
  • Adding Cover Art to Video Files

    Guest
    A better program is A/V Cover Artist found here http://download.cnet.com/A-V-Cover-Artist/3000-13631_4-75915891.html?tag=mncol;1 ...

    Read more...

     
  • Adding Cover Art to Video Files

    Guest
    THIS . . .this is what your looking for. Easy to use and does exactly what it claims. Thank you ...

    Read more...

     
  • Dynamic DataTable with JSF 2.0

    Guest
    First thank you for this good work. What's like your html page ? are this, i have nothing a blank ...

    Read more...

Go to top