how to make graphic2D object into a png image file

i have made a graphic2D object which is show in a jPanel, of which the graphic2D can somehow modified by user. And i want to capture the graphic2D and output it as a png file. can anyone tell me how to do so, thx~~
[221 byte] By [boysinga] at [2007-10-2 22:01:16]
# 1
http://www.discoverteenergy.com/files/ScreenImage.java
camickra at 2007-7-14 1:17:33 > top of Java-index,Desktop,Core GUI APIs...