[Java Programming] Programs on creating Applets. [Science Tutor]

8.1: Program on building applet with jdk.

                import java.awt.*;
                import java.applet.*;
                public class Hello extends Applet                 
{
                                Public void paint(Graphics g)
                {
                                g.drawString(“Hello Java”,10,100);
                }
                }

Output
                Save as: Hello.java
                Compile as: javac Hello.java



8.2:Program on creating HTML file on applet.

<HTML>
<! This is program of Applets>
<HEAD>
<TITLE>Welcome to Java applets</H1>
</HEAD>
</BODY>
<CENTER>
<H1>Welcome to the world of Java applets</H1>
</CENTER>
<CENTER>
<APPLET
                CODE=Hello.java
                WIDTH=200
                HEIGHT=400>>/APPLET>
</CENTER>
</BODY>
</HTML>


Output

               
Applet Viewer

Hello.java
 
 















-



Post a Comment

0 Comments