1
128729972
Guest
Ok I have not seen A applet tutorial yet in this forum so here is one. I am unshure of how to use notepad at all when writing java and running it so anyone using it or knows how to make that work I'll edit my guid to fit its standerd's.
I will explain what each part of the code does and for you swan I have reserched the data correctly. in my next tutorials on applets I will not explain the parts here.
tell the compiler where to find the methods you will use.
and is required when you create an applet.
required to paint on screen
the start of an applet - HelloWorld will be the executable class
Extends applet means that you will build the code on the standard Applet class
The method that will be automatically called when the applet is started.
It is required but does not need anything.
This method gets called when the applet is terminated
That's when the user goes to another page or exits the browser.
Nothing needed yet.
The standard method that you have to use to paint things on screen
This overrides the empty Applet method, you can't just call it "display".
method to draw text on screen
String first, then x and y coordinate.
That's it. My next tutorial will be on drawing shapes on the screen.
I will explain what each part of the code does and for you swan I have reserched the data correctly. in my next tutorials on applets I will not explain the parts here.
Code:
import java.applet.*;
and is required when you create an applet.
Code:
import java.awt.*;
Code:
public class HelloWorld extends Applet
{
the start of an applet - HelloWorld will be the executable class
Extends applet means that you will build the code on the standard Applet class
Code:
public void init()
{
Code:
}
It is required but does not need anything.
Code:
public void stop()
{
This method gets called when the applet is terminated
That's when the user goes to another page or exits the browser.
Code:
}
Nothing needed yet.
Code:
public void paint(Graphics g)
{
The standard method that you have to use to paint things on screen
This overrides the empty Applet method, you can't just call it "display".
Code:
g.drawString("Hello World!",20,20);
g.drawString("GoodBye World!",20,40);
}
}
method to draw text on screen
String first, then x and y coordinate.
That's it. My next tutorial will be on drawing shapes on the screen.

