Applet One

Internet Technology School. Instructor Jeff Zhuk

Applet One on the left side presents a target.
It can be a moving target.
You can touch it by mouse click.
That's what you do next...
So far look at the source below:

// AppletOne.java import java.applet.Applet; import java.awt.Graphics; import java.awt.Color; public class AppletOne extends Applet { public void paint(Graphics g) { g.setColor(Color.blue); g.drawOval(40,40,30,40); g.fillRect(30,70,50,100); g.drawString("Hi, people from the Earth !!!",20, 190); } }


Instructions: Use Windows 95 "Notepad" application (look at Accessories) to open AppletOne.java file. Then COPY and PASTE the Java source from this HTML page to the file. Save as "c:\jdk\java\mysrc\AppletOne.java". Open MS DOS window and type: cd c:\jdk\java\mysrc javac AppletOne.java dir

Congratulations !!! You created your first Java class. You can modify it now playing with colors and sizes. Come back to the training page and select View/Document Source menu. This is HTML source. Copy it by pressing CTRL/C and recreate the file "appletone.html" in the same directory. To PASTE use EDIT/PASTE menu or press CTRL/V. You can point your brouser to this file now and play with your applet.