DefaultListModel Exception

Is there anyone that can help me with this exception. It is occurring outside of my source and i cannot catch it.

Exception is as follows:

Exception in thread "AWT-EventQueue-0" java.lang.ArrayIndexOutOfBoundsException: 4 >= 4

at java.util.Vector.elementAt(Unknown Source)

at javax.swing.DefaultListModel.getElementAt(Unknown Source)

at javax.swing.plaf.basic.BasicListUI.paintCell(Unknown Source)

at javax.swing.plaf.basic.BasicListUI.paintImpl(Unknown Source)

at javax.swing.plaf.basic.BasicListUI.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.paintChildren(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.JComponent.paintChildren(Unknown Source)

at javax.swing.JComponent.paint(Unknown Source)

at javax.swing.JLayeredPane.paint(Unknown Source)

at javax.swing.JComponent.paintChildren(Unknown Source)

at javax.swing.JComponent.paint(Unknown Source)

at javax.swing.JComponent.paintToOffscreen(Unknown Source)

at javax.swing.BufferStrategyPaintManager.paint(Unknown Source)

at javax.swing.RepaintManager.paint(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.RepaintManager.paintDirtyRegions(Unknown Source)

at javax.swing.RepaintManager.seqPaintDirtyRegions(Unknown Source)

at javax.swing.SystemEventQueueUtilities$ComponentWorkRequest.run(Unknown Source)

at java.awt.event.InvocationEvent.dispatch(Unknown Source)

at java.awt.EventQueue.dispatchEvent(Unknown Source)

at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)

at java.awt.EventDispatchThread.pumpEventsForFilter(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 have been looking at the error for a while now and it seems to occur when i remove from a Jlist.

I am using it like this:

Model.removeElement(String);

any help would be greatly appreciated

[2933 byte] By [tmohra] at [2007-11-27 11:13:03]
# 1

In the future, Swing related questions should be posted in the Swing forum.

Read the JList API and follow the "How to Use Lists" link to the Swing tutorial which has a working example of how to add and remove items from a JList.

camickra at 2007-7-29 13:58:27 > top of Java-index,Java Essentials,Java Programming...
# 2

Thanks.....got the answer......there was no problem with my jlists.....nothing even GUI setup related for that matter......apologies for the post location.....i have never resorted to it before.....This is part of the reason why......have a great day

cheers

tmohra at 2007-7-29 13:58:27 > top of Java-index,Java Essentials,Java Programming...