Hi,
I have a custom cell factory that provides table cells with text boxes and other controls inside - but unlike the default TextFieldTableCell they are always in edit mode or more precisely they don't use edit mode but always render a text field that is bound to the model.
After adding a new row to the table, I want to focus the first cell/column, so that the user can immediately start filling in the contents. However, both of my ideas to do that failed:
Using the FocusModel of the table did not work:
table.requestFocus();
table.getFocusModel().focus(newRowIndex, firstColumn);
The entire row is highlighted (not as "selected" but as "focused"), but the text field *inside* the table cell is not focused.
So I would need something like:
table.getCell(newRowIndex, firstColumn).getGraphic().requestFocus()
but that does not exist:
For UI tests, I have a rather hacky solution similar to the cell()-Method here: https://github.com/SmartBear/TestFX/blob/master/src/main/java/org/loadui/testfx/controls/TableViews.java But I don't want something like that in my actual application code.
Are there any other possibilities to achieve this?
Thanks for any help!
Philipp