Article View: borland.public.jbuilder.java.swing
Article #1177Re: TabbedPane Exception
From: pNichols
Date: Tue, 20 Jan 2004 20:20
Date: Tue, 20 Jan 2004 20:20
73 lines
3594 bytes
3594 bytes
Zoran Pjevic wrote:
> I am using a TabbedPane with a dozen of tabs.
>
> From time to time, mostly when starting the very first time, after
> rebooting the machine I get following exception:
>
>
> java.lang.ArrayIndexOutOfBoundsException: 1
> at
> javax.swing.plaf.basic.BasicTabbedPaneUI.paintTabArea(Unknown Source)
> at javax.swing.plaf.basic.BasicTabbedPaneUI.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.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(Unknown
> 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 have disabled now all threads that are dropping data to the tabbed
> panels, but it still happens.
>
> Basicallly what is left now - related to the tabbed panels is:
>
> In the construtor of my frame:
>
> JTabbedPane MyTabbedPane = new JTabbedPane();
>
> jTabbedPane_PSMMI.setEnabled(false);
>
> jTabbedPane_PSMMI.add(jPanel_1, "Panel 1");
> jTabbedPane_PSMMI.add(jPanel_2, "Panel 2");
> ...
> jTabbedPane_PSMMI.add(jPanel_11, "Panel 11");
> jTabbedPane_PSMMI.add(jPanel_12, "Panel 12");
>
> And then later in my main loop:
>
> if (MyjTabbedPane != null) {
> MyTabbedPane.setSelectedComponent(jPanel_10);
> MyTabbedPane.setEnabled(true);
> }
>
> From the dumped stack info I cannot relate the problem to my code.
>
> Is this a known problem with the TabbedPane? I am using the
> java version 1.4.1-b21.
>
It sounds as though not all of the panels are being invoked before they are
called. Are you threading any of the calls to create the panels? If so, are
they synchronized?
I see where you are adding the panels, but do not see how the panels are
created.
Technical Details
Message-ID:
<400d8b43@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!nntp-relay.ihug.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mailReferences:
<0agq00t45krqet4bg3s3pnrfi180i192mn@4ax.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 111d45,c686a89ee3fe2b61 X-Google-Attributes: gid111d45,public X-Google-ArrivalTime: 2004-01-20 12:32:21 PST Message-ID: <400d8b43@newsgroups.borland.com> From: pNichols <paul@computer-logic.net> Subject: Re: TabbedPane Exception Newsgroups: borland.public.jbuilder.java.swing Reply-To: paul@computer-logic.net Date: Tue, 20 Jan 2004 15:20:00 -0500 References: <0agq00t45krqet4bg3s3pnrfi180i192mn@4ax.com> Lines: 75 Organization: Computer Logic User-Agent: KNode/0.7.2 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7Bit NNTP-Posting-Host: 68.71.188.25 X-Trace: newsgroups.borland.com 1074629443 68.71.188.25 (20 Jan 2004 12:10:43 -0700) Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!nntp-relay.ihug.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail