Have a look at Java's own Applet tutorial,
Lesson: Applets (The Java™ Tutorials > Deployment)
Code snippets you'll want to look at:
<applet code=HelloWorld.class width="200" height="200"></applet>
import javax.swing.JApplet;
import java.awt.Graphics;
public class HelloWorld extends JApplet {
public void paint(Graphics g) {
g.drawRect(0, 0,
getSize().width - 1,
getSize().height - 1);
g.drawString("Hello world!", 5, 15);
}
}
Also Java's API is invaluable. Familiarize yourself with it and it will help you solve many problems very quickly.
Java 2 Platform SE v1.3.1
Java tutorial site:
The Java™ Tutorials
Usually when I need to find something Java related I head to Google, search: Java api 'whatever' and will find a related document in the api files.
Example: for this thread a googled: Java api Applet and that tutorial was the first link.
Greetings.