Spades: Often you need to use a bunch of images for your applet. The best thing to do in this case is to create an array of images before your init method like this:
Image sp[];
sp = new Image[13];
for(int i=0; i<13; i++){
sp[i]=getImage(getDocumentBase(), idCard(i));
}
public String idCard(int val){
String out = "cards/";
switch(val){
case 0: out+="A"; break;
case 1: out+="2"; break;
case 2: out+="3"; break;
case 3: out+="4"; break;
case 4: out+="5"; break;
case 5: out+="6"; break;
case 6: out+="7"; break;
case 7: out+="8"; break;
case 8: out+="9"; break;
case 9: out+="T"; break;
case 10: out+="J"; break;
case 11: out+="Q"; break;
case 12: out+="K"; break;
}
out += "S.gif";
return out;
}
for(int x=0; x<13; x++) {
g.drawImage(sp[x], 10+x*50, 50, this);
}
sp[0]=getImage(getDocumentBase(), "AS.gif"); sp[1]=getImage(getDocumentBase(), "2S.gif"); sp[2]=getImage(getDocumentBase(), "3S.gif"); etc.