Posted Wednesday, June 19, 2013 @ 05:13:20
I'm using QuickTable version 3.0 with the current version of swing libraries provided by netbeans 7.3 and I got the following exception setting a column with Type.LONGVARCHAR:
java.lang.ClassCastException: javax.swing.JScrollPane cannot be cast to javax.swing.JTextArea
The same error rise when the db schema has a field of this type (TEXT, LONGTEXT from mysql or LONGVARCHAR with HSQLDB).
Investingating the source code the class DBTableColumnModel seems bugged. In facts at line 354
where o refverence was got with the following code:
dc = new DBTableCellEditor(Column.TEXTAREA_CELL,null, dbTable);
I checked and o is really a JScrollPane instance not its view, JTextArea.
A patched the code adding a line like:
JTextArea txt = (JTextArea) ((JScrollPane) o).getViewport().getView();
and it looks like working fine.
Now the questions are:
a) was i wrong in setting up the grid or it is effectively a bug ?
b) may this fix produce unwanted side effects in other scenarios ?
Thanks a lot for your support.