Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / GUI / June 2005

Tip: Looking for answers? Try searching our database.

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

Thread view: 
jobs239@hotmail.com - 23 Jun 2005 23:18 GMT
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 - 24 Jun 2005 05:07 GMT
> 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
[quoted text clipped - 4 lines]
>
> 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.

Signature

Knute Johnson
email s/nospam/knute/

Nigel Wade - 24 Jun 2005 09:11 GMT
> 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
[quoted text clipped - 5 lines]
> 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)
[quoted text clipped - 16 lines]
> 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)

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...

Signature

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

jobs239@hotmail.com - 24 Jun 2005 19:22 GMT
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 - 25 Jun 2005 20:49 GMT
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.


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.