I am trying to display an image on a Frame, however the image doesn't fit exactly on the frame. How can I resize the image? I cannot resize the frame. I need it to stay the same size all the time.
// Override paint():
public void paint (Graphics g)
{
Dimension dimension = this.getSize();
Insets I = this.getInsets();
Toolkit tk = Toolkit.getDefaultToolkit();
try{
URL u = new URL ("http://www.gstatic.com/hostedimg/c195c33263b5205c_large");
Image img = tk.getImage(u);
g.drawImage(img, 0+I.left, 0+I.top, this);
}
catch(MalformedURLException e){
System.out.println(e);
}
}