I use a custom cell renderer that implements TableCellRenderer and displays a JTextArea (instead of JLabel) for each row. I basically override the getTableCellRendererComponent (...) method with mine, which does some extra calculations on the line. These calculations should be done only once to update the table. Since the getTableCellRendererComponent method is called with every mouse movement, a lag occurs. Therefore, I thought that I should prevent the call to getTableCellRendererComponent to avoid lag.
Questions:
1) My table has only 1 column and has no header.
2) My data is static and is read from an ArrayList using the getValueAt (int row, int column) method in the user class tablemodel that implements AbstractTableModel.
3) I do not need to follow the mouse movement events.
4) I do not expect a lot of data, so I may need to display the entire table at once or completely cache it.
5) Most of the lags are caused by setting the text every time you return from getTableCellRendererComponent, since some lines use right-to-left characters, and RTL text requires additional time for rendering.
source
share