java.lang.IllegalStateException Exception, when creating bufferstrategy -


i'm trying develop own game engine, i've run java.lang.illegalstateexception exception. when call graphic class main, should create buffer strategy , set java's graphics , on, it's not doing create buffer strategy part. instead it's giving me illegalstateexception.

here's code:

public class graphic extends canvas{     private graphics g;      public graphic() {         bufferstrategy bs = getbufferstrategy();         if(bs == null) { createbufferstrategy(3); return; }         g = bs.getdrawgraphics();          g.drawstring("hello", 2, 2);          g.dispose();         bs.show();     } } 


Comments

Popular posts from this blog

javascript - how to protect a flash video from refresh? -

visual studio 2010 - Connect to informix database windows form application -

android - Associate same looper with different threads -