I recently upgraded to the version of dbSwing.jar bundled with JBuilder
X and JDK 1.4. I'd previously been using dbSwing3.0.jar with JDK 1.3.
The code compiles fine with this new version of the library, but I get
lots of exceptions when running. The first problem I had was with:
jdbTable1.getColumnModel().getColumn(2);
This caused the following exception:
java.lang.ArrayIndexOutOfBoundsException: 2 >= 1
at java.util.Vector.elementAt(Vector.java:431)
at
javax.swing.table.DefaultTableColumnModel.getColumn(DefaultTableColumnModel.java:277)
at
lu.scoteqint.seiBrowser.JListView.dataSet_opened(JListView.java:381)
at
lu.scoteqint.seiBrowser.PnlBrowser_dataSet_openAdapter.opened(PnlBrowser.java:1147)
at com.borland.dx.dataset.DataSet.a(Unknown Source)
at com.borland.dx.dataset.DataSet.open(Unknown Source)
at com.borland.dbswing.JdbTable.bindDataSet(JdbTable.java:2749)
It looks like this is an attempt to access a column which doesn't exist
(but if so, why didn't dbSwing3.0.jar throw an exception?). Anyway, I
commented this code out, but then the following call:
jdbTable1.setHiddenColumns(new int[]{0,1});
Generates this exception:
java.lang.NullPointerException
at com.borland.dbswing.JdbTable.bindDataSet(JdbTable.java:2758)
at com.borland.dbswing.JdbTable.addNotify(JdbTable.java:2733)
at java.awt.Container.addNotify(Container.java:2049)
at javax.swing.JComponent.addNotify(JComponent.java:4291)
In both cases, the following line features in the stack trace in both
cases:
newFrame.setVisible(true); //newFrame contains JdbTable1
so my best guess is that it's something to do with the order in which
the columns are constructed, and when they may be shown/hidden, but I'm
really not too sure what's going on. Has anyone else had similar
problems when moving from dbSwing3.0 or JDK 1.3?
Many thanks in advance!
Don