Hi everyone,
I am trying to export a jcomponent as an image. The program all works but seriously the the quality of the saved image is really disgusting.
The words seems to be blurred. I think i have to use rendereing hints but i am not sure how there work or which hint to use for my situation.

Here is the code i use to convert a jcomponent to an image file

public void exporttableasjpeg(JComponent Component)
{
String k;

FileChooser1.setDialogType(JFileChooser.SAVE_DIALOG);
FileChooser1.setDialogTitle("Select Export File");

if(FileChooser1.showDialog(fr1, "Export") != JFileChooser.APPROVE_OPTION)
{
return;
}

File f = FileChooser1.getSelectedFile();
k = (f.toString() + ".JPG");
Dimension Size4 = Component.getSize();
BufferedImage Image1= new BufferedImage(Size4.width, Size4.height, BufferedImage.TYPE_INT_RGB);
Graphics2D g2 = Image1.createGraphics();
//I need someone to suggest a good hint to use for this situation

g2.setRenderingHint(RenderingHints.KEY_INTERPOLATION,RenderingHints.VALUE_INTERPOLATION_BI CUBIC);
Component.paint(g2);

try
{
OutputStream out = new FileOutputStream(k);
JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(out);
encoder.encode(Image1);
out.close();
}

catch (Exception e)
{
Label1.setText("An error exporting the table as an image has occurred");
}

}

Basically i need someone to tell me if i am using the rendering hint in the right way and also to recommend an appropriate hint for my situation

Thank You

Yours Sincerely

Richard West