Jack of Spades

Jack of Spades: It is more common that you will want to load an image which is saved as a file than that you will actually create your image in Java. You will save the picture shown below into your working directory and load it into an applet as shown below.
Step One: Save this picture:



Step Two: Write the code to load the picture in an applet.

Before the init class write:

    Image c;
Now in the init class write:
    c=getImage(getDocumentBase(), "cards/JS.gif");
Obviously, if you don't have your image file in a directory called cards, you would simply write "JS.gif".

Finally, write the following line in your paint method:

    g.drawImage(c, 10, 10, this);