File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Swing / AWT / SWT and the fly likes Exception in JTable Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Exception in JTable" Watch "Exception in JTable" New topic

Exception in JTable

Flavio Nobili
Ranch Hand

Joined: Jan 28, 2004
Posts: 58
Hello All,
I'm building an application that loads records from a database and presents them in a JTable. All seems to work ok, but sometimes the following error is diplayed:

java.lang.ArrayIndexOutOfBoundsException: 6 >= 1
at java.util.Vector.elementAt(Unknown Source)
at javax.swing.table.DefaultTableColumnModel.getColumn(Unknown Source)
at suncertify.client.RoomsTableColumnModel.getColumn(
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.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$ 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 Source)

It's strange because sometimes it's displayed, and sometimes not. I can't identify what is causing the problem, since it happens without any change. Does anyone knows what is going on?


Java Developer
Nathan Pruett

Joined: Oct 18, 2000
Posts: 4121

Are your columns dynamically generated? It looks like the code thinks there are 6 columns, when really there is only 1...

For a better answer, you'd need to post the relevant code from your "RoomsTableColumnModel"...

Write once, run anywhere, because there's nowhere to hide! - /. A.C.
I agree. Here's the link:
subject: Exception in JTable
It's not a secret anymore!