FEST-Swing provides support for editing JTable cells as if a user was doing it. Out of the box, JCheckBoxes, JComboBoxes and JTextFields are supported as custom cell editors:

There are many ways to simulate a user editing a JTable cell:
1. JTableFixture
JTableFixture provides the method enterValue(TableCell, String) which simulates a user entering the given value in the given cell, regardless of the underlying cell editor. Even though the value to enter is always a String, JTableFixture can figure out how to use the underlying cell editor.
The following code listing illustrates how to select the value "Pool" from the JComboBox in row 0, column 2 (see picture above).
JTableFixture table = dialog.table("data"); table.enterValue(row(0).column(2), "Pool");
Here we are selecting the JCheckBox in row 1, column 4:
JTableFixture table = dialog.table("data"); table.enterValue(row(1).column(4), "true");
2. JTableCellFixture
JTableCellFixture provides the method enterValue(String), which can also simulate a user editing a table cell, just like JTableFixture.
The following code listing illustrates how to select the value "Pool" from the JComboBox in row 0, column 2:
JTableFixture table = dialog.table("data"); JTableCellFixture cell = table.cell(row(0).column(2)); cell.enterValue("Pool");
Here we are selecting the JCheckBox in row 1, column 4:
JTableFixture table = dialog.table("data"); JTableCellFixture cell = table.cell(row(1).column(4)); cell.enterValue("true");
Having more control of the cell editor
To have more control of the underlying cell editor, It is possible to it with a ComponentFixture. JTableCellFixture provides the method editor, which returns the Component used as cell editor of a cell. JTableCellFixture also provides the methods startEditing, stopEditing and cancelEditing. The following example illustrates how to use them:
TableCellFixture cell = table.cell(row(6).column(8)); Component editor = cell.editor(); // assume editor is a JTextField JTextComponentFixture textBoxEditor = new JTextComponentFixture(robot, (JTextField)editor); cell.startEditing(); textBoxEditor.enterText("Hello"); cell.stopEditing();
Custom cell editors
FEST-Swing also supports custom cell editors. For more information, please read Custom Cell Editors.
