Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

java.lang.ArrayIndexOutOfBoundsException: 5 ArrayOutOfBound exception in BasicTabbedPaneUI.paintTabArea

38 views
Skip to first unread message

job...@hotmail.com

unread,
Jun 23, 2005, 6:18:06 PM6/23/05
to
I sometimes get the following exception when I first bring up my GUI.
Since the stack contains nothing from my code, I don't know what
triggers it. Since the problem happens intermittently and is not
reproducible, I am really at a loss. Any help in debugging this will be
highly appreciated. It always throws an array out of bounds exception
but the number seems to be different.

java.lang.ArrayIndexOutOfBoundsException: 5
at
javax.swing.plaf.basic.BasicTabbedPaneUI.paintTabArea(BasicTabbedPaneUI.java:535)
at
javax.swing.plaf.basic.BasicTabbedPaneUI$ScrollableTabPanel.paintComponent(BasicTabbedPaneUI.java:2960)
at javax.swing.JComponent.paint(JComponent.java:808)
at javax.swing.JComponent.paintChildren(JComponent.java:647)
at javax.swing.JComponent.paint(JComponent.java:817)
at javax.swing.JViewport.paint(JViewport.java:722)
at javax.swing.JComponent.paintChildren(JComponent.java:647)
at javax.swing.JComponent.paint(JComponent.java:817)
at javax.swing.JComponent.paintChildren(JComponent.java:647)
at javax.swing.JSplitPane.paintChildren(JSplitPane.java:1021)
at javax.swing.JComponent.paint(JComponent.java:817)
at
javax.swing.JComponent.paintWithOffscreenBuffer(JComponent.java:4787)
at
javax.swing.JComponent.paintDoubleBuffered(JComponent.java:4740)
at
javax.swing.JComponent._paintImmediately(JComponent.java:4685)
at
javax.swing.JComponent.paintImmediately(JComponent.java:4488)
at
javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:410)
at
javax.swing.SystemEventQueueUtilities$ComponentWorkRequest.run(SystemEventQueueUtilities.java:117)
at
java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:178)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:454)
at
java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:201)
at
java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:151)
at
java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:145)
at
java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:137)
at
java.awt.EventDispatchThread.run(EventDispatchThread.java:100)

Knute Johnson

unread,
Jun 24, 2005, 12:07:08 AM6/24/05
to
job...@hotmail.com wrote:
> I sometimes get the following exception when I first bring up my GUI.
> Since the stack contains nothing from my code, I don't know what
> triggers it. Since the problem happens intermittently and is not
> reproducible, I am really at a loss. Any help in debugging this will be
> highly appreciated. It always throws an array out of bounds exception
> but the number seems to be different.
>
> java.lang.ArrayIndexOutOfBoundsException: 5

My best guess would be that you are trying to paint or paint on
something that isn't there yet. On occaision when I have gotten
exceptions I can't locate, I'll put a big try/catch block around as much
code as possible and do a printStackTrace(). That will help identify
the location of the exception.

--

Knute Johnson
email s/nospam/knute/

Nigel Wade

unread,
Jun 24, 2005, 4:11:41 AM6/24/05
to
job...@hotmail.com wrote:

The most likely reason is that you are not following the guidelines on
creating the GUI in the EDT by using SwingUtilities.invokeLater()
http://java.sun.com/docs/books/tutorial/uiswing/misc/threads.html. If you
perform some action which starts the EDT running, and then continue to
initialise your GUI in the main thread this is the type of unpredicable
behaviour which can occur.

Given that you haven't posted any code all I can do is guess...

--
Nigel Wade, System Administrator, Space Plasma Physics Group,
University of Leicester, Leicester, LE1 7RH, UK
E-mail : n...@ion.le.ac.uk
Phone : +44 (0)116 2523548, Fax : +44 (0)116 2523555

job...@hotmail.com

unread,
Jun 24, 2005, 2:22:52 PM6/24/05
to
Its difficult to post the code because its a big code base and I don't
know which part triggers this exception. However I tried one thing. I
have a routine that does a removeAll for the tabbed pane and does
addTab for a bunch of tabs. I put a check before that function call
for SwingUtilities.isEventDispatchThread() and it returned false. Could
this be the problem. Should I put the call to this routine within
invokeLater?

Alan Moore

unread,
Jun 25, 2005, 3:49:02 PM6/25/05
to
Are you calling setFocusable(false) on the JTabbedPane? If so, try
calling setRequestFocusEnabled(false) instead. There's a known bug
connected with painting focus rectangles that's caused by checking for
the one condition but not the other.
0 new messages