hi,
I'm trying to write an application where I want to add different pictures on a Jpanel. Everything works fine except for the JPG format which displays very bad quality images. This is how I do the drawing :
class draw extends Canvas
{
Dimension canvasSize = new Dimension(400, 400);
String fileName;
public void paint(Graphics g)
{
if(this.fileName!=null)
{
Toolkit toolkit = Toolkit.getDefaultToolkit();
Image img = toolkit.getImage(fileName);
g.drawImage(img, 0, 0, this);
}
}
public void setFileName(String name)
{
this.fileName=name;
}
public Dimension getMinimumSize()
{
return canvasSize;
}
public Dimension getPreferredSize()
{
return canvasSize;
}
}
Is there a way such that JPG format is covered ?