Java Solaris Communities Sun Store Join SDN My Profile Why Join?
 
Bug Database
Bug Detail
Quick Lists
Top 25 Bugs
Top 25 RFE's
Recently Closed Bugs
Printable Page Printable Page


Bug Database
Bug ID: 4071278
Votes 5
Synopsis Size restriction on GridBagLayout=512
Category java:classes_awt
Reported Against 1.1.1 , 1.1.6 , 1.1.8 , kestrel
Release Fixed
State 11-Closed, duplicate of 4254022, bug
Priority: 4-Low
Related Bugs 4254022
Submit Date 12-AUG-1997
Description




In java.awt.GridBagLayout (v1.1 & v1.1.1) we have the
following:

public class GridBagLayout implements LayoutManager2,
                                      java.io.Serializable {
 
  protected static final int MAXGRIDSIZE = 512;
	:
	:
	}


The maximum number of rows ( & columns ) is set by a constant
and cannot be changed. I have a scroll area and require more
than 512 widgets.

======================================================================




I can consistently get GridBagLayout to throw the following exception:

java.lang.ArrayIndexOutOfBoundsException
        at java.awt.GridBagLayout.GetLayoutInfo(Compiled Code)
        at java.awt.GridBagLayout.preferredLayoutSize(GridBagLayout.java:476)
        at java.awt.Container.preferredSize(Container.java:563)
        at java.awt.Container.getPreferredSize(Container.java:546)
        at javax.swing.JComponent.getPreferredSize(Compiled Code)
        at camcyber.repl.snmp.mrgo.QueryResultDialog.displayByRow(Compiled Code)
...

The problem appears to be associated with the number of rows in the layout. If there are fewer than about 512 rows, then I never get the exception. The exception always gets thrown if there are more than about 512 rows in the layout.
(Review ID: 95774)
======================================================================
Work Around




1) Allow MAXGRIDSIZE to be overridden in constructor? -- ok solution.
2) Allow dynamic resizing for any grid dimensions? -- best solution.
3) Make MAXGRIDSIZE very big - poor solution.
======================================================================




Make sure that there are no more than 512 rows in a GridBagLayout
(Review ID: 95774)
======================================================================
Evaluation
12/11/99   xxxxx@xxxxx   -- true in all source trees through kestrel FCS build "Q".  (Adding a customer record for kestrel, and skipping all the intervening releases)


We should definitely fix this for Merlin.  I am closing this as a duplicate of 
4254022 since the fix for that bug - using a vector instead of an array - 
will fix this one as well.  
  xxxxx@xxxxx   1999-12-22
Comments
  
  Include a link with my name & email   

Submitted On 05-APR-1999
paul_cornelius
April 1999: Still a problem.


Submitted On 22-NOV-1999
danlip
November 1999: Still a problem.  This is over 2 years old!!!
This bug is particularly annoying because:
<ul>
<li>It allows you to add more than 512 components,
and doesn't throw an error until you try to lay it out.
<li>It only throws an ArrayIndexOutOfBoundsException with no
meaningful error like "You can only have 512 components in a
GridBagLayout"
</ul>


Submitted On 10-DEC-2006
Ashish_Ahlawat
Can any body help me regarding following error occur when starts an applet.:- if yes pls mail me at ahlawat.ashish@gmail.com

Exception in thread "Thread-26" java.lang.ArrayIndexOutOfBoundsException: 512
	at java.awt.GridBagLayout.GetLayoutInfo(Unknown Source)
	at java.awt.GridBagLayout.getLayoutInfo(Unknown Source)
	at java.awt.GridBagLayout.preferredLayoutSize(Unknown Source)
	at java.awt.Container.preferredSize(Unknown Source)
	at java.awt.Container.getPreferredSize(Unknown Source)
	at java.awt.ScrollPane.calculateChildSize(Unknown Source)
	at java.awt.ScrollPane.layout(Unknown Source)
	at java.awt.ScrollPane.doLayout(Unknown Source)
	at java.awt.Container.validateTree(Unknown Source)
	at java.awt.Container.validate(Unknown Source)
	at KSC.processlister.changehappened(processlister.java:508)
	at KSC.processlister.parseLine(processlister.java:372)
	at KSC.imanclient.run(imanclient.java:210)
	at java.lang.Thread.run(Unknown Source)



PLEASE NOTE: JDK6 is formerly known as Project Mustang