Skip to content
Advertisement

JavaFX Table Cell Editing

I am trying to make a program in Java to manage my bookie accounts. I’m new to java, so I thought I would chose something simple to see how things work. I decided to use a tableview and make the individual cells editable. I’ve been following this tutorial http://java-buddy.blogspot.co.uk/2012/04/javafx-2-editable-tableview.html. It details how to do it using java code, and copying that into a new class works perfectly. I decided to try and tweak it to work with FXML, since I like Sceneviewer. My issue is, data is loaded in to the table, but when I click/doubleclick a cell, nothing happens. Here’s my code.

testController.java

JavaScript

And here is my Account.java file.

JavaScript

Lastly, here is my fxml file.

JavaScript

As I said earlier, nothing happens when I click on the Username cell. No errors, no textfield, just nothing. Any help would be greatly appreciated! Thanks

Advertisement

Answer

I haven`t tried your example, but I think you just forgot to set the cellFactory for the specific column. Adding the folowing line should fix it:

JavaScript
User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement