It is important that more than 1 line is displayed in a cell. To do this, I wrote class MultiLineCellRenderer that extends JTextArea and implements TableCellRenderer (solution I found on the Internet).
Then I realised that the cells should not be editable. For this, I wrote class MyTableModel that extends AbstractTableModel (again, solution from the Internet).
So I apllied both to the table, like this:
table.setModel(new MyTableModel(data, columnNames));
table.setDefaultRenderer(String.class, new MultiLineCellRenderer());
The problem: It looks like I can use either one or the other. If I use the renderer for my table, multiple lines are shown in cells, but the cells are editable. If I use the table model, or both, then the cells are not editable, but only 1 line is displayed in each cell :-/
Any suggestions? Can the renderer and the table model be used together?