posted 18 years ago
Hi
I got the soultion. Instead of converting component to buffered image directly ... convert the component to image and then the image to buffered image. THis way the image get created correctly.
Image image = (Image)_component.createImage( _component.getWidth(),
_component.getHeight() );
//image converted to buffered image
BufferedImage bufferedImage = new BufferedImage ( _component.getWidth(),
_component.getHeight() , BufferedImage.TYPE_INT_BGR );
Graphics2D g = (Graphics2D)image.getGraphics();
_component.paint( g ); // draw the component on image
bufferedImage.createGraphics().drawImage( image, 0, 0, null);
ImageIO.write( bufferedImage, "jpg", file );