14 Replies Latest reply on Jun 4, 2011 4:42 AM by EJP

    How do I change the background color of a BufferedImage?

      I have a program and basically what I am doing is drawing on a BufferedImage object and then painting that BufferedImage object onto the panel. By default, the background is black and it draws in white. I am easily able to change the colour for drawing by doing g2.setColor(Color.RED) for example where g2 is the Graphics2D object created by image.createGraphics(). I tried g2.setBackground(Color.WHITE) and that did not work.

      If more information is needed, just ask.

      Any help in changing the background colour of the BufferedImage would be greatly appreciated!
      Thanks in advance!