This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 61384

Summary: Get ArrayOutOfBound Exception when try to switch from absoluteLayout to gridBagLayout
Product: guibuilder Reporter: annawang <annawang>
Component: CodeAssignee: issues@guibuilder <issues>
Status: RESOLVED FIXED    
Severity: blocker    
Priority: P3    
Version: 4.x   
Hardware: PC   
OS: Windows XP   
Issue Type: DEFECT Exception Reporter:

Description annawang 2005-07-25 22:33:53 UTC
I have a form which has nested panels, I first did the GUI using 
absoluteLayout, then switch all layout manager to GridBagLayout. I got a array 
index out of bound exception when I tried to do the switch for the outmost 
layer.
I had this same issue with 4.1 betta and 4.1. After the exception happens, 
netbean failed to launch.
The following is from the log file:

java.lang.ArrayIndexOutOfBoundsException: 512
	at java.awt.GridBagLayout.GetLayoutInfo(GridBagLayout.java:888)
	at java.awt.GridBagLayout.getLayoutInfo(GridBagLayout.java:806)
	at java.awt.GridBagLayout.preferredLayoutSize(GridBagLayout.java:630)
	at java.awt.Container.preferredSize(Container.java:1178)
	at java.awt.Container.getPreferredSize(Container.java:1162)
	at javax.swing.JComponent.getPreferredSize(JComponent.java:1277)
	at java.awt.GridBagLayout.GetLayoutInfo(GridBagLayout.java:892)
	at java.awt.GridBagLayout.getLayoutInfo(GridBagLayout.java:806)
	at java.awt.GridBagLayout.ArrangeGrid(GridBagLayout.java:1374)
	at java.awt.GridBagLayout.arrangeGrid(GridBagLayout.java:1337)
	at java.awt.GridBagLayout.layoutContainer(GridBagLayout.java:706)
	at java.awt.Container.layout(Container.java:1020)
	at java.awt.Container.doLayout(Container.java:1010)
	at java.awt.Container.validateTree(Container.java:1092)
	at java.awt.Container.validateTree(Container.java:1099)
	at java.awt.Container.validate(Container.java:1067)
	at javax.swing.plaf.basic.BasicTabbedPaneUI.ensureCurrentLayout
(BasicTabbedPaneUI.java:1145)
	at javax.swing.plaf.basic.BasicTabbedPaneUI.paint
(BasicTabbedPaneUI.java:490)
	at javax.swing.plaf.ComponentUI.update(ComponentUI.java:142)
	at javax.swing.JComponent.paintComponent(JComponent.java:541)
	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.paintChildren(JComponent.java:647)
	at javax.swing.JSplitPane.paintChildren(JSplitPane.java:1021)
	at javax.swing.JComponent.paint(JComponent.java:817)
	at javax.swing.JComponent.paintChildren(JComponent.java:647)
	at javax.swing.JComponent.paint(JComponent.java:817)
	at java.awt.GraphicsCallback$PaintCallback.run(GraphicsCallback.java:21)
	at sun.awt.SunGraphicsCallback.runOneComponent
(SunGraphicsCallback.java:60)
	at sun.awt.SunGraphicsCallback.runComponents
(SunGraphicsCallback.java:97)
	at java.awt.Container.paint(Container.java:1312)
	at org.netbeans.modules.form.fakepeer.FakePeerContainer.paint
(FakePeerContainer.java:54)
	at javax.swing.JComponent.paintChildren(JComponent.java:659)
	at javax.swing.JComponent.paint(JComponent.java:817)
	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.JComponent.paint(JComponent.java:817)
	at javax.swing.JLayeredPane.paint(JLayeredPane.java:557)
	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.JComponent.paint(JComponent.java:817)
	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.JComponent.paint(JComponent.java:817)
	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.JComponent.paint(JComponent.java:817)
	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.JComponent.paint(JComponent.java:817)
	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.paintChildren(JComponent.java:647)
	at javax.swing.JSplitPane.paintChildren(JSplitPane.java:1021)
	at javax.swing.JComponent.paint(JComponent.java:817)
	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.JComponent.paint(JComponent.java:817)
	at javax.swing.JLayeredPane.paint(JLayeredPane.java:557)
	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.JComponent.paint(JComponent.java:817)
	at javax.swing.JComponent.paintChildren(JComponent.java:647)
	at javax.swing.JComponent.paint(JComponent.java:817)
	at javax.swing.JLayeredPane.paint(JLayeredPane.java:557)
	at javax.swing.JComponent.paintChildren(JComponent.java:647)
	at javax.swing.JComponent.paintWithOffscreenBuffer(JComponent.java:4794)
	at javax.swing.JComponent.paintDoubleBuffered(JComponent.java:4740)
	at javax.swing.JComponent.paint(JComponent.java:798)
	at java.awt.GraphicsCallback$PaintCallback.run(GraphicsCallback.java:21)
	at sun.awt.SunGraphicsCallback.runOneComponent
(SunGraphicsCallback.java:60)
	at sun.awt.SunGraphicsCallback.runComponents
(SunGraphicsCallback.java:97)
	at java.awt.Container.paint(Container.java:1312)
	at org.netbeans.core.windows.view.ui.MainWindow.paint
(MainWindow.java:528)
	at sun.awt.RepaintArea.paint(RepaintArea.java:177)
	at sun.awt.windows.WComponentPeer.handleEvent(WComponentPeer.java:260)
	at java.awt.Component.dispatchEventImpl(Component.java:3678)
	at java.awt.Container.dispatchEventImpl(Container.java:1627)
	at java.awt.Window.dispatchEventImpl(Window.java:1606)
	at java.awt.Component.dispatchEvent(Component.java:3477)
[catch] at java.awt.EventQueue.dispatchEvent(EventQueue.java:456)
	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)
Comment 1 Jan Stola 2005-07-26 17:15:00 UTC
I am sorry I am not able to reproduce the issue. Could you, please,
attach the problematic form (the absolute layout version before conversion
to GridBagLayout). You can also e-mail it to me personally.

The root of the problem is that the GridBagLayout supports at most 512
columns/rows. The conversion from the absolute layout probably exceeds
this limit. We should handle such situations more gracefully.
Comment 2 Jan Stola 2005-07-29 10:43:39 UTC
"Fixed." If the form cannot be correctly converted due to limitations
of GridBagLayout (as in your case) then the user is notified about
this fact and the components are added to GridBagLayout with the default
constraints.
Comment 3 Jan Stola 2005-08-03 09:38:35 UTC
*** Issue 60556 has been marked as a duplicate of this issue. ***
Comment 4 Jan Stola 2005-11-10 14:48:05 UTC
*** Issue 68327 has been marked as a duplicate of this issue. ***