JDK-4071278 : Size restriction on GridBagLayout=512
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 1.1.1,1.1.6,1.1.8,1.3.0
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS:
    generic,solaris_2.5.1,solaris_2.6,solaris_7 generic,solaris_2.5.1,solaris_2.6,solaris_7
  • CPU: generic,sparc
  • Submitted: 1997-08-12
  • Updated: 1999-12-22
  • Resolved: 1999-12-22
Related Reports
Duplicate :  
Description

Name: sg39081			Date: 08/12/97


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.
company - R. A. Ward Ltd. , email - ###@###.###
======================================================================

Name: krT82822			Date: 09/27/99


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)
======================================================================

Comments
WORK AROUND Name: sg39081 Date: 08/12/97 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. ====================================================================== Name: krT82822 Date: 09/27/99 Make sure that there are no more than 512 rows in a GridBagLayout (Review ID: 95774) ======================================================================
11-06-2004

EVALUATION 12/11/99 kevin.ryan@eng -- 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. eric.hawkes@eng 1999-12-22
22-12-1999