Posted by: Sourav | July 11, 2012

Creating my first applet with java


The code for applet1.java

import java.applet.Applet;
import java.awt.*;
public class applet1 extends Applet {
    
    public void paint(Graphics g) {
        
        g.drawString(“Hello from java!”,60,100);
    }
    
}

The code for applet.html

<html>
    <head>
        <title>
                    
        </title>
              
    </head>
    <body>
        <HR>
            <center>
                <applet
                        
                        code=applet1.class
                        width=200
                        height=200
                        
                </applet>
                                
            </center>
        
    </body>
       
</html>

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Categories

%d bloggers like this: