|
Type EVERYTHING. The Java compiler
is case-sensitive, follow the code exactly.
Lets Begin.
Open Notepad.
Select new Document
Type this exactly as it is
shown here
import java.applet.*;
import java.awt.*;
/**
* The LamersSuck class implements an applet that
* simply displays "Lamers Suck!".
*/
public class LamersSuck extends Applet {
public void paint(Graphics g) {
// Display "Lamers Suck!"
g.drawString("Lamers Suck!", 50, 25);
}
}
Save this code as LamersSuck.java
Create HTML file to accompany your applet turn around and
take the HTML tutorials as I suggested in the intro
if you don't know how yet. Use this HTML:
<HTML>
<HEAD>
<TITLE>Lamers Suck</TITLE>
</HEAD>
<BODY>
Everyone Knows That....
<APPLET CODE="LamersSuck.class" WIDTH=150 HEIGHT=25>
</APPLET>
</BODY>
</HTML>
Go to the DOS prompt like you did in lesson 1, if you
haven't done lesson 1 turn around and do it.
Type javac LamersSuck.java and click enter
The compiler will generate Java bytecode file, LamersSuck.class.
upload both LamersSuck.class. and lamers.html
to the web. You have just made your first applet.
Now that you have made an Application and an
Applet we are going to start learning what we did and why
over the next tutorials I just wanted you to start
by making something right away so you could
get a feel for it so the next part will make more sense.
The next part is going to introduce the
various parts of Java when we get through that we will make some
more nifty lil progs.
|