Print

Print


Hi folks,

it is me again. I have another problem (of course). My Simstate class 
runs perfectly but when I try to get it working with the GUI it fails 
with following error:

Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
     at 
sim.portrayal.geo.GeomVectorFieldPortrayal.hitOrDraw2(GeomVectorFieldPortrayal.java:325)
     at 
sim.portrayal.geo.GeomVectorFieldPortrayal.hitOrDraw(GeomVectorFieldPortrayal.java:219)
     at sim.portrayal.FieldPortrayal2D.draw(FieldPortrayal2D.java:84)
     at 
sim.display.Display2D$InnerDisplay2D.paintUnbuffered(Display2D.java:643)
     at sim.display.Display2D$InnerDisplay2D.paint(Display2D.java:568)
     at 
sim.display.Display2D$InnerDisplay2D.paintComponent(Display2D.java:498)
     at 
sim.display.Display2D$InnerDisplay2D.paintComponent(Display2D.java:485)
     at javax.swing.JComponent.paint(JComponent.java:1054)
     at javax.swing.JComponent.paintChildren(JComponent.java:887)
     at javax.swing.JComponent.paint(JComponent.java:1063)
     at javax.swing.JViewport.paint(JViewport.java:731)
     at javax.swing.JComponent.paintChildren(JComponent.java:887)
     at javax.swing.JComponent.paint(JComponent.java:1063)
     at javax.swing.JComponent.paintChildren(JComponent.java:887)
     at javax.swing.JComponent.paint(JComponent.java:1063)
     at javax.swing.JComponent.paintChildren(JComponent.java:887)
     at javax.swing.JComponent.paint(JComponent.java:1063)
     at javax.swing.JComponent.paintToOffscreen(JComponent.java:5221)
     at 
javax.swing.BufferStrategyPaintManager.paint(BufferStrategyPaintManager.java:295)
     at javax.swing.RepaintManager.paint(RepaintManager.java:1236)
     at javax.swing.JComponent._paintImmediately(JComponent.java:5169)
     at javax.swing.JComponent.paintImmediately(JComponent.java:4980)
     at javax.swing.RepaintManager$3.run(RepaintManager.java:796)
     at javax.swing.RepaintManager$3.run(RepaintManager.java:784)
     at java.security.AccessController.doPrivileged(Native Method)
     at 
java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
     at 
javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:784)
     at 
javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:757)
     at 
javax.swing.RepaintManager.prePaintDirtyRegions(RepaintManager.java:706)
     at javax.swing.RepaintManager.access$1000(RepaintManager.java:62)
     at 
javax.swing.RepaintManager$ProcessingRunnable.run(RepaintManager.java:1647)
     at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:251)
     at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:733)
     at java.awt.EventQueue.access$200(EventQueue.java:103)
     at java.awt.EventQueue$3.run(EventQueue.java:694)
     at java.awt.EventQueue$3.run(EventQueue.java:692)
     at java.security.AccessController.doPrivileged(Native Method)
     at 
java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
     at java.awt.EventQueue.dispatchEvent(EventQueue.java:703)
     at 
java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:242)
     at 
java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:161)
     at 
java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:150)
     at 
java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:146)
     at 
java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:138)
     at java.awt.EventDispatchThread.run(EventDispatchThread.java:91)

The simulation worked before, even in the GUI. The only thing which 
changed is how I calculate the next movement of the agents. As how i 
understand MASON/GEOMASON the gui gets the coordinates of the agents via 
the GeomVectorFieldPortrayal of the agents which has the GeomVectorfield 
as field. Is that right?
Because what didn't change is how the coordinate is set for the agent. 
Do you have any idea how I can solve this problem? If you need 
code-passages let me know.

Thanks,
Norman