Program for Demonistrating LIFE CYCLE OF APPLET

import java.awt.*; import java.applet.Applet; import java.awt.event.*; import java.applet.*; public class App extends Applet imple...

import java.awt.*;
import java.applet.Applet;
import java.awt.event.*;
import java.applet.*;
public class App extends Applet implements ActionListener
{
            TextField text1,text2,ans;
            Label plus;
            Button bt;
            public void init()
            {
                        text1=new TextField();
                        text2=new TextField();
                        ans=new TextField();
                        plus=new Label("+");
                        bt=new Button("=");
                        bt.addActionListener(this);
                        add(text1);
                        add(plus);
                        add(text2);
                        add(bt);
                        add(ans);
            }
            public void actionPerformed(ActionEvent e)
            {
                        if(e.getSource()==bt)
                        {
int sum=Integer.parseInt(text1.getText())+Integer.parseInt(text2.getText());
                                    ans.setText(String.valueOf(sum));
           
                        }
            }
}

APPLET.HTML

<html>
<head>
<title> APPLET</title>
</head>
<body bgcolor="yellow">

<applet code="App" width="200" height="300"/>
</body>
</html>


OUTPUT:

applet

Related

Explain Java Environment?

Java environment includes a large number of development tools are part of the system known as Java development kit is the classes is methods are part of the Java sta...

Explain Java Command Line Arguments?

The way of providing input at the time of exection is known as command line arguments. Command line arguments are parameters that are supplied to the application program at...

Explain Java Tokens?

A Java program is basically a collection of classes. A class is defined by a set of declaration statements and methods containing executable statements. ...

Post a Comment

emo-but-icon
:noprob:
:smile:
:shy:
:trope:
:sneered:
:happy:
:escort:
:rapt:
:love:
:heart:
:angry:
:hate:
:sad:
:sigh:
:disappointed:
:cry:
:fear:
:surprise:
:unbelieve:
:shit:
:like:
:dislike:
:clap:
:cuff:
:fist:
:ok:
:file:
:link:
:place:
:contact:

item