Thanks for your interest, Model and Controller posted on list.Kind regards,Stewart.--On 2 April 2018 at 19:31, Robert Zupko <[log in to unmask]> wrote:array[ndx, ndy] = /* math */for (int ndy = 0; ndy < height; ndy++) {for (int ndx = 0; ndx < width; ndx++) {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;
}
}On Mon, Apr 2, 2018 at 2:17 PM, Stewart Aitken <00000068a29a4109-dmarc-reques[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.getOf fset(BoxView.java:1101) at javax.swing.text.BoxView.child Allocation(BoxView.java:695) at javax.swing.text.CompositeView .getChildAllocation(CompositeV iew.java:232) at javax.swing.text.BoxView.getCh ildAllocation(BoxView.java:453 ) at javax.swing.plaf.basic.BasicTe xtUI$UpdateHandler.calculateVi ewPosition(BasicTextUI.java:19 99) at javax.swing.plaf.basic.BasicTe xtUI$UpdateHandler.layoutConta iner(BasicTextUI.java:1975) at java.awt.Container.layout(Cont ainer.java:1511) at java.awt.Container.doLayout(Co ntainer.java:1500) at java.awt.Container.validateTre e(Container.java:1696) at java.awt.Container.validateTre e(Container.java:1705) at java.awt.Container.validateTre e(Container.java:1705) at java.awt.Container.validateTre e(Container.java:1705) at java.awt.Container.validateTre e(Container.java:1705) at java.awt.Container.validateTre e(Container.java:1705) at java.awt.Contai!
ner.validateTree(Container.java:1705) at java.awt.Container.validateTre e(Container.java:1705) at java.awt.Container.validateTre e(Container.java:1705) at java.awt.Container.validate(Co ntainer.java:1631) at java.awt.Window.dispatchEventI mpl(Window.java:2744) at java.awt.Component.dispatchEve nt(Component.java:4711) at java.awt.EventQueue.dispatchEv entImpl(EventQueue.java:758) at java.awt.EventQueue.access$500 (EventQueue.java:97) at java.awt.EventQueue$3.run(Even tQueue.java:709) at java.awt.EventQueue$3.run(Even tQueue.java:703) at java.security.AccessController .doPrivileged(Native Method) at java.security.ProtectionDomain $JavaSecurityAccessImpl.doInte rsectionPrivilege(ProtectionDo main.java:80) at java.security.ProtectionDomain $JavaSecurityAccessImpl.doInte rsectionPrivilege(ProtectionDo main.java:90) at java.awt.EventQueue$4.run(Even tQueue.java:731) at java.awt.EventQueue$4.run(Even tQueue.java:729) at java.security.AccessController .doPrivileged(Native Method) at java.security.Pro!
tectionDomain$JavaSecurityAccessImpl.doIntersectionPrivileg e(ProtectionDomain.java:80) at java.awt.EventQueue.dispatchEv ent(EventQueue.java:728) at java.awt.EventDispatchThread.p umpOneEventForFilters(EventDis patchThread.java:201) at java.awt.EventDispatchThread.p umpEventsForFilter(EventDispat chThread.java:116) at java.awt.EventDispatchThread.p umpEventsForHierarchy(EventDis patchThread.java:105) at java.awt.EventDispatchThread.p umpEvents(EventDispatchThread. java:101) at java.awt.EventDispatchThread.p umpEvents(EventDispatchThread. java:93) at java.awt.EventDispatchThread.r un(EventDispatchThread.java:82 ) Exception in thread "main" java.lang.ArrayIndexOutOfBound sException: -1 at javax.swing.text.BoxView.getOf fset(BoxView.java:1101) at javax.swing.text.BoxView.child Allocation(BoxView.java:695) at javax.swing.text.CompositeView .getChildAllocation(CompositeV iew.java:232) at javax.swing.text.BoxView.getCh ildAllocation(BoxView.java:453 ) at javax.swing.plaf.basic.BasicTe xtUI$UpdateHandler.calculateVi ewPosition(BasicTextUI.java:19 99) at javax.swing.plaf.ba!
sic.BasicTextUI$UpdateHandler.layoutContainer(BasicTextUI. java:1975) at java.awt.Container.layout(Cont ainer.java:1511) at java.awt.Container.doLayout(Co ntainer.java:1500) at java.awt.Container.validateTre e(Container.java:1696) at java.awt.Container.validateTre e(Container.java:1705) at java.awt.Container.validateTre e(Container.java:1705) at java.awt.Container.validateTre e(Container.java:1705) at java.awt.Container.validateTre e(Container.java:1705) at java.awt.Container.validateTre e(Container.java:1705) at java.awt.Container.validateTre e(Container.java:1705) at java.awt.Container.validateTre e(Container.java:1705) at java.awt.Container.validateTre e(Container.java:1705) at java.awt.Container.validate(Co ntainer.java:1631) at java.awt.Container.validateUnc onditionally(Container.java:16 68) at java.awt.Window.show(Window.ja va:1033) at java.awt.Component.show(Compon ent.java:1671) at java.awt.Component.setVisible( Component.java:1623) at java.awt.Window.setVisible(Win dow.java:1014) at!
sim.algs.alg2.SimEnviro2WithUI.main(SimEnviro2WithUI.java:32 )