
Do not use the JBuilder Applet Wizard at this step
1. Following the following steps to create your first applet
a. Import the following packages into your program
import java.applet.*;
import java.awt.*;
b. Create a class of your choice
c. Extend the class from java.applet.Applet class
d. Add the following method
public void paint(Graphics g)
e. Add g.drawString(“Hello World”,25,25)
f. Save the program to a file HelloWorld.java
g. Compile the file
h. Create the following html file
<html>
<applet codebase=“.” code=“HelloWorld.class” height=100
width=100 >
</applet>
</html>
i. Save this file to the location where your class file resides
2. Try JBuilder to create a similar applet
3. Write code to display Bio-Data of your Institute
4. Modify your program and add the following line of code to change you font
color
g.setColor(Color.green);
5. Use following methods to draw some rectangles and circles
a. g.drawLine (int, int ,int, int);
b. g.drawOval(int, int ,int, int);
c. g.fillOval(int, int ,int, int);
d. g.drawPolygon(int xpoints[], int ypoints[],int numpoints);
6. Use the following code to load an image
Image img=getImage(getCodeBase(),"test.gif");
g.drawImage(img,40,40,50,50,this);
7. Use the following code to experience the life cycle of an applet
public class AppLife extends Applet{
public void init(){
System.out.println("Init called"); }
public void start(){
System.out.println("strat called") }
public void paint(Graphics g){
g.drawString("Paint called",25,25); }
public void stop(){
System.out.println("Calling stop"); }
public void destroy(){
System.out.println("Calling destroy"); }}
8. Use your drawing skills and graphics methods to draw the following calendar
Exercise-01
Java-Programming