I have a bit of a problem converting a JTextPane to an image.
I am able to convert the JTextPane to a PNG image but its quality is really bad. Is there a way that i can convert my JTextPane to a high quality image.
The type of image format does not matter
Here is what i have so far
public void export(JComponent Component)
File f1 = new File("C:\\Temp.PNG");
Dimension Size5 = Component.getSize();
BufferedImage Image1 = new BufferedImage(Size5.width, Size5.height, BufferedImage.TYPE_INT_ARGB);
Graphics2D g2 = Image1.createGraphics();
ImageIO.write(Image1, "PNG", f1);
catch (Exception e)
I hope someone can help with this problem
Any help is greatly appreciated
01-24-2005, 12:43 PM
An alternative strategy could be to emule print screen key (using robot class) then save the clipboard content (clipboard class) to a BMP file, yet honestly I haven't try it.