craftleft.gif (3002 bytes)QuickTable
Home | API | Tutorial | Download | Support | Contact topblack.gif (108 bytes)


QuickTable User Cp  |  Register  |  Members  |  Search  |  Help
    |- QuickTable Discussion Forums > CellEditor/Renderer Post New Topic   Post A Reply
Bug with LONGVARCHAR columns printer friendly version
next oldest post
Author Messages
pipp8
Private

Gender: Male
Location: Italy
Registered: Jun 2013
Status: Offline
Posts: 1

Click here to see the profile for pipp8 Send email to pipp8 Send private message to pipp8 Find more posts by pipp8 Edit or delete this message Reply w/Quote
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
at quick.dbtable.DBTableColumnModel.setType(DBTableColumnModel.java:354)
at quick.dbtable.DBTableColumnModel.createColumnModel(DBTableColumnModel.java:81)
at quick.dbtable.DBTableModel.createColumnModelFromQuery(DBTableModel.java:2726)
at quick.dbtable.DBTableModel.createColumnModelFromQuery(DBTableModel.java:2609)

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

setLength((JTextArea)o,tc.getLength());

where o refverence was got with the following code:
dc = new DBTableCellEditor(Column.TEXTAREA_CELL,null, dbTable);
tc.setCellEditor(dc);
o= dc.getComponent();

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();
setLength(txt,tc.getLength());

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.

--------------------
[pipp8]

Post New Topic   Post A Reply Jump to:
Contact Us | QuickTable - A Java DBGrid | Privacy Policy All times are GMT -5 Hours.
Welcome to QuickTable Forums, Guest!  
Login
Username :
Password :
In order to fully utilize the abilities of this board, you are required to register as a member. Registration is free, and allows you to do lots of things including turning on or off certain features of this board. Register now!
Powered by CuteCast v2.0 BETA 2
Copyright © 2001-2003 ArtsCore Studios