• Post Reply Bookmark Topic Watch Topic
  • New Topic

DefaultTableColumnModel

 
Kris Reid
Ranch Hand
Posts: 247
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I posted a similar message in Java Advanced Forum and it was recommended that I post here.
http://www.coderanch.com/t/326739/java/java/DefaultTableColumnModel


Basically I have several remote(RMI) JTables that get updated by a database. Every now and then one of them with throw an exception which will be something like:

java.lang.ArrayIndexOutOfBoundsException: 3 >= 2
at java.util.Vector.elementAt(Unknown Source)
at javax.swing.table.DefaultTableColumnModel.getColumn(Unknown Source)
at javax.swing.plaf.basic.BasicTableUI.paintCells(Unknown Source)
at javax.swing.plaf.basic.BasicTableUI.paint(Unknown Source)
at javax.swing.plaf.ComponentUI.update(Unknown Source)
at javax.swing.JComponent.paintComponent(Unknown Source)
at javax.swing.JComponent.paint(Unknown Source)
at javax.swing.JComponent.paintChildren(Unknown Source)
at javax.swing.JComponent.paint(Unknown Source)
at javax.swing.JViewport.paint(Unknown Source)
at javax.swing.JComponent.paintChildren(Unknown Source)
at javax.swing.JComponent.paint(Unknown Source)
at javax.swing.JComponent.paintWithOffscreenBuffer(Unknown Source)
at javax.swing.JComponent.paintDoubleBuffered(Unknown Source)
at javax.swing.JComponent._paintImmediately(Unknown Source)
at javax.swing.JComponent.paintImmediately(Unknown Source)
at javax.swing.RepaintManager.paintDirtyRegions(Unknown Source)
at javax.swing.SystemEventQueueUtilities$ComponentWorkRequest.run(Unknow
n Source)
at java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)

at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)


I can not understand why it only happens to one and not all Tables.
I have extended JTable to check the data before it updates and all screens print the same.

protected class MyTable extends JTable {

public MyTable(TableModel DataModel) {
super(DataModel);
}

public synchronized void setModel(TableModel dataModel) {
for (int i = 0; i < getColumnCount(); i++)
System.out.println(i + " " + columnModel.getColumn(i).getHeaderValue() );

super.setModel(dataModel); //THIS IS THE LINE THAT CAUSES THE ERROR

System.out.println("ERROR");
}
}


I hope someone can help....Thanks
 
Kris Reid
Ranch Hand
Posts: 247
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It actually seems to be a bug in JDK1.4
I just upgraded to JDK1.5 and it works perfect!
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!