Can you share some of the code? The exception indicates an indexing error which is fairly unusual if you are using a pattern like the following: int height = 6, width = 5; for (int ndx = 0; ndx < width; ndx++) { for (int ndy = 0; ndy < height; ndy++) { array[ndx, ndy] = /* math */ } } On Mon, Apr 2, 2018 at 2:17 PM, Stewart Aitken < [log in to unmask]> wrote: > Hello, > > I currently have a simulation where I am creating square and long thin > horizontal rectangles in ObjectGrid2D. > Using grids that range from 900 cells to 2500 cells. > > A toy model typically has width of 6 and height of 5 and everything works, > all 30 cells are filled. > > Now, I have to change to long thin vertical rectangles to provide a > comparison to the horizontal rectangles. > > Hence, I have width as 5 and height as 6. The result is that the grid > fills up to width squared and then never stops. > In this case the grid has 30 cells and 25 of them are filled and the last > five remain empty. > > Can anyone advise me as to how to overcome this or is it just inherent > that the height cannot be more than the width? > > Eclipse debug gives this error: > > Exception in thread "AWT-EventQueue-0" java.lang. > ArrayIndexOutOfBoundsException: -1 at javax.swing.text.BoxView.getOffset(BoxView.java:1101) > at javax.swing.text.BoxView.childAllocation(BoxView.java:695) at > javax.swing.text.CompositeView.getChildAllocation(CompositeView.java:232) > at javax.swing.text.BoxView.getChildAllocation(BoxView.java:453) at > javax.swing.plaf.basic.BasicTextUI$UpdateHandler.calculateViewPosition(BasicTextUI.java:1999) > at javax.swing.plaf.basic.BasicTextUI$UpdateHandler. > layoutContainer(BasicTextUI.java:1975) at java.awt.Container.layout(Container.java:1511) > at java.awt.Container.doLayout(Container.java:1500) at java.awt.Container. > validateTree(Container.java:1696) at java.awt.Container. > validateTree(Container.java:1705) at java.awt.Container. > validateTree(Container.java:1705) at java.awt.Container. > validateTree(Container.java:1705) at java.awt.Container. > validateTree(Container.java:1705) at java.awt.Container. > validateTree(Container.java:1705) at java.awt.Contai! > ner.validateTree(Container.java:1705) at java.awt.Container. > validateTree(Container.java:1705) at java.awt.Container. > validateTree(Container.java:1705) at java.awt.Container.validate(Container.java:1631) > at java.awt.Window.dispatchEventImpl(Window.java:2744) at > java.awt.Component.dispatchEvent(Component.java:4711) at > java.awt.EventQueue.dispatchEventImpl(EventQueue.java:758) at > java.awt.EventQueue.access$500(EventQueue.java:97) at > java.awt.EventQueue$3.run(EventQueue.java:709) at > java.awt.EventQueue$3.run(EventQueue.java:703) at java.security. > AccessController.doPrivileged(Native Method) at java.security. > ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:80) > at java.security.ProtectionDomain$JavaSecurityAccessImpl. > doIntersectionPrivilege(ProtectionDomain.java:90) at > java.awt.EventQueue$4.run(EventQueue.java:731) at > java.awt.EventQueue$4.run(EventQueue.java:729) at java.security. > AccessController.doPrivileged(Native Method) at java.security.Pro! > tectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:80) > at java.awt.EventQueue.dispatchEvent(EventQueue.java:728) at > java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201) > at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116) > at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105) > at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101) > at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93) > at java.awt.EventDispatchThread.run(EventDispatchThread.java:82) > Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: -1 > at javax.swing.text.BoxView.getOffset(BoxView.java:1101) at > javax.swing.text.BoxView.childAllocation(BoxView.java:695) at > javax.swing.text.CompositeView.getChildAllocation(CompositeView.java:232) > at javax.swing.text.BoxView.getChildAllocation(BoxView.java:453) at > javax.swing.plaf.basic.BasicTextUI$UpdateHandler.calculateViewPosition(BasicTextUI.java:1999) > at javax.swing.plaf.ba! > sic.BasicTextUI$UpdateHandler.layoutContainer(BasicTextUI.java:1975) at > java.awt.Container.layout(Container.java:1511) at > java.awt.Container.doLayout(Container.java:1500) at java.awt.Container. > validateTree(Container.java:1696) at java.awt.Container. > validateTree(Container.java:1705) at java.awt.Container. > validateTree(Container.java:1705) at java.awt.Container. > validateTree(Container.java:1705) at java.awt.Container. > validateTree(Container.java:1705) at java.awt.Container. > validateTree(Container.java:1705) at java.awt.Container. > validateTree(Container.java:1705) at java.awt.Container. > validateTree(Container.java:1705) at java.awt.Container. > validateTree(Container.java:1705) at java.awt.Container.validate(Container.java:1631) > at java.awt.Container.validateUnconditionally(Container.java:1668) at > java.awt.Window.show(Window.java:1033) at java.awt.Component.show(Component.java:1671) > at java.awt.Component.setVisible(Component.java:1623) at > java.awt.Window.setVisible(Window.java:1014) at! > sim.algs.alg2.SimEnviro2WithUI.main(SimEnviro2WithUI.java:32) >