java - Printing objects work but drawing it won't? -


so every time try draw list of objects won't draw it. have draw methods under class , seems works since while loop under update() method works should. if iterates through list , prints out correctly how can implement read same list under paintcomponent? seems if when try gives me null pointer exception means must empty.

update:

public void update(iobservable o, object arg){     gwp = (gameworldproxy) o;     gameobjects = gwp.getcollection().getiterator();     while(gameobjects.hasnext()){         gameobject gameobj = (gameobject) gameobjects.getnext();         system.out.println(gameobj);     }     this.repaint(); } 

paintcomponent:

public void paintcomponent(graphics g){     super.paintcomponent(g);     while(gameobjects.hasnext()){         gameobject gameobj = (gameobject) gameobjects.getnext();         gameobj.draw(g);     }  } 


Comments

Popular posts from this blog

jQuery Mobile app not scrolling in Firefox -

c++ - How to add Crypto++ library to Qt project -

php array slice every 2th rule -