title: Java graphics are flashing
body: <p>Okay, I understand your need for an SSCCE, so I created (my first) one.</p>
  
  <p>I managed to replicate the problem with under 200 lines of code. On my system this demo compiled and ran perfectly (only the flickering was still there of course).
  I stripped everything that had nothing to do with it. So basically we have two source files now: the screen manager and the game manager.</p>
  
  <p>The screen manager:
  <a href="http://pastebin.com/WeKpxEXW" rel="nofollow">http://pastebin.com/WeKpxEXW</a></p>
  
  <p>The game manager:
  <a href="http://pastebin.com/p3C5m8UN" rel="nofollow">http://pastebin.com/p3C5m8UN</a></p>
  
  <p>You can compile this code with this make file (I use a ported version of Linux' make for Windows):
      CC = javac
      BASE = nl/jorikoolstra/jLevel
      CLASS_FILES = classes/$(BASE)/Game/GameMain.class classes/$(BASE)/Graphics/ScreenManager.class</p>
  
  <pre><code>jLevel: $(CLASS_FILES)
      @echo Done.
  
  classes/%.class : src/%.java
      @echo Compiling src/$*.java to $@ [command: $(CC) src/$*.java ] ...
      @$(CC) -Xlint:unchecked -d classes -classpath src src/$*.java
  </code></pre>
  
  <p>Where the source files are placed in the <code>/src</code> directory and the classes in the <code>/classes</code> directory.</p>
  
  <p>After compilation to byte-code the game can be started using the following .bat file:</p>
  
  <pre><code>@set STARUP_CLASS=nl.jorikoolstra.jLevel.Game.GameMain
  @set ARGUMENTS=1280 1024 32
  @java -cp classes;resources %STARUP_CLASS% %ARGUMENTS%
  </code></pre>
  
  <p>Note that the <code>ARGUMENT</code> variable depends on your own screen settings and that you have to change it so that the game is displayed in the right resolution for your screen.</p>