This HTML page contains:
Here is the source code that I compiled using javac, the Sun Microsystems bytecode compiler, to obtain the class file I reference in this HTML page.
/**
* Import classes from the package for user interface elements, awt
*/
import java.awt.Graphics;
import java.awt.Font;
import java.awt.Color;
/**
* Declare the applet. An applet must be a public class.
* My applet extends the applet class with my customizations.
*/
public class HelloAgainApplet extends java.applet.Applet {
/**
* Specify the appearance, content, and horizontal/vertical pixel
* positions of the text strings the applet displays.
*/
Font f = new Font("TimesRoman", Font.BOLD, 30);
public void paint(Graphics g) {
g.setFont(f);
g.setColor(Color.red);
g.drawString("Hello from Thomas Albert.", 5, 50);
g.drawString("I wrote this simple Java applet.", 10, 100);
g.drawString("Here is the gist of the code:", 30, 150);
g.drawString("(1) Import awt classes for Graphics, Font, and Color.", 40, 200);
g.drawString("(2) Declare my extension to the applet class.", 40, 250);
g.drawString("(3) Specify string appearance, content, and position.", 40, 300);
}
}
How did I do it?
- Java in a Nutshell (O'Reilly)
- Teach Yourself Java (Sams.net)
- Talk Java To Me (Waite Group Press--multimedia)