Now that's interesting. Is the problem just that you're seeing 0 width and 0 height, or that this triggers something which freaks out? In any case, could you create a stack trace when this occurs? Sean Pelle Evensen wrote: > I have a problem in a portrayal's draw() method, sometimes the draw > field from the DrawInfo2D object and the newinfo and info from > SparseGridPortrayal2D looks like this for *some* calls in an update; > > SparseGridPortrayal2D > newinfo: DrawInfo2D[ Draw: > java.awt.geom.Rectangle2D$Double[x=352.0,y=107.0,w=0.0,h=0.0] Clip: > java.awt.geom.Rectangle2D$Double[x=0.0,y=0.0,w=500.0,h=400.0]] > info: DrawInfo2D[ Draw: > java.awt.geom.Rectangle2D$Double[x=0.0,y=0.0,w=500.0,h=400.0] Clip: > java.awt.geom.Rectangle2D$Double[x=0.0,y=0.0,w=500.0,h=400.0]] > Our portrayal's draw(), info.draw: > java.awt.geom.Rectangle2D$Double[x=352.0,y=107.0,w=0.0,h=0.0] > > This is the code (more or less) where we set up the portrayal; > public static void setupPortrayals(SimState state, Display2D display) { > SparseGridPortrayal2D barterPortrayal = new SparseGridPortrayal2D(); > int width = display.getWidth(); > int height = display.getHeight(); > SparseGrid2D agentPositions = new SparseGrid2D(width, height); > for(Agent e : agents) { > agentPositions.setObjectLocation(e, Math.sin(idx) * idx, > Math.cos(idx) * idx); > idx++; > } > barterPortrayal.setField(agentPositions); > display.attach(barterPortrayal, "Agents"); > barterPortrayal.setPortrayalForClass( > Agent.class, > new BasicAgentPortrayal((Simulation) state)); > > display.reset(); > display.repaint(); > } > > Regards, > Pelle