What i am trying to do is set the size of an applet to the size of an Image.
Code:
import java.awt.*;
import java.net.*;
import javax.swing.*;
import java.applet.*;
public class AvatarViewer extends Applet{
private Image image;
public void init(){
try{
// image = getImage(newURL("file:///C:/Pics/braninlittlechina.jpg"));
image = getImage(new URL("file:///C:/Pics/vampire.gif"));
setSize(image.getWidth(this), image.getHeight(this));
}catch(Exception e){System.err.println(e);}
}
public void paint(Graphics g){
g.drawImage(image,50,50,this);
}
}