Hi all.

I needed to draw a picture- a rather intricate one- using java. This I managed. But the drawback was, when it created the .PNG file, it also displayed it. This wouldn't be a problem, except when I exit the displayed version of the image, it deletes the file.
This is the first method
Code:
public void runPaint(Pmc workS)
	{
		//ImageOut t = new ImageOut();
		//t.paint(null);
		
		BufferedImage bi = new BufferedImage(930,1200, BufferedImage.TYPE_INT_ARGB); 
		Graphics g = bi.createGraphics();
		paint(g, workS); 
		g.dispose();
		try{ImageIO.write(bi,"png",new File("test.png"));}catch (Exception e) {}
	}
which calls the following method. (this is just a selection)

Code:
public void paint(Graphics g, Protomech workS)
	{
.... 
g.setColor(Color.black);
		g.fillRect(0,0,930,1200);
		
....
}
What I need is a way to avoid creating the Graphics g- to be able to create my image directly as a BufferedImage, which just gets saved as a .PNG without ever being displayed.

Any idea how I do that?