title: composite graphics white to xor
body: <p>I have a panel where I paint an image. 
  It is a grayscale image and when I used java 1.7, the code would set itself to interpret white as alpha on the paint and repaint methods like this:</p>
  
  <pre><code>g.setXORMode(Color.WHITE);
  g.drawImage(image, 0, 0, width, height, 0, 0, image.getWidth(),
              image.getHeight(), null, null);
  </code></pre>
  
  <p>when i started using java 1.8 tu run it, I got a 
  java.lang.ClassCastException: sun.java2d.loops.XORComposite cannot be cast to java.awt.AlphaComposite
  error message, so as a quick fix, I just disabled XOR.</p>
  
  <p>How do I get the same result now with java 1.8?
  Or is there some other way to 'fix' this?</p>
  
  <p>Thank you.</p>