{"id":6980,"date":"2014-05-16T01:18:15","date_gmt":"2014-05-16T01:18:15","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/05\/16\/slick2d-java-game-crashing-when-i-setbackground-collection-of-common-programming-errors\/"},"modified":"2014-05-16T01:18:15","modified_gmt":"2014-05-16T01:18:15","slug":"slick2d-java-game-crashing-when-i-setbackground-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2014\/05\/16\/slick2d-java-game-crashing-when-i-setbackground-collection-of-common-programming-errors\/","title":{"rendered":"Slick2d java game crashing when I setBackground();-Collection of common programming errors"},"content":{"rendered":"<p>I&#8217;m using slick2d and in my Java application. In my render method I use a method called changeBackground();<\/p>\n<pre><code>@Override\npublic void render(GameContainer gc, StateBasedGame sbg, Graphics g)\n        throws SlickException {\nchangeBackground(g);\n}\n<\/code><\/pre>\n<p>changeBackground();<\/p>\n<pre><code>public void changeBackground(Graphics g) throws SlickException{\n    Thread.sleep(500);\n    g.setBackground(new org.newdawn.slick.Color(0, 255, 0);\n    Thread.Sleep(500);\n    g.setBackground(new org.newdawn.slick.Color(255, 0, 0);\n    changeBackground(g);\n}\n<\/code><\/pre>\n<p>When I run my application the game crashes.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I&#8217;m using slick2d and in my Java application. In my render method I use a method called changeBackground(); @Override public void render(GameContainer gc, StateBasedGame sbg, Graphics g) throws SlickException { changeBackground(g); } changeBackground(); public void changeBackground(Graphics g) throws SlickException{ Thread.sleep(500); g.setBackground(new org.newdawn.slick.Color(0, 255, 0); Thread.Sleep(500); g.setBackground(new org.newdawn.slick.Color(255, 0, 0); changeBackground(g); } When I run my [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-6980","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/6980","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=6980"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/6980\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=6980"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=6980"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=6980"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}