Witshaper is the Professional (Computing Skills, English Learning and Soft Skills) Skill Development Training Center. We provide Professional IT Courses and Soft Skill Training in Dehradun to Students, Employees and organization. Who wish to pursue a career in IT Technology. Witshaper is led by a motivated team of IT experts and Soft Skill Professionals. We provide high quality trainings. Our Emphasis is on giving the practical knowledge to the students, so that they will get to know in depth and never forget what they opt, we provide to the students real learning environment. Witshaper prepares students and professionals to be the part of this growing industry. Be a part of Witshaper and get your dreams successful

Sunday 15 May 2016

Applet program to implement basic arithmetic operations( Add,multiply);

import java.awt.*;
import java.applet.*;
import java.awt.event.*;

public class Applet67 extends Applet implements Action Listener
{
Label l1,l2,l3;
Text Field t1,t2,t3,;
Button  b1,b2,b3,b4,b5;
public void init()
{
l1=new Label ("number 1");
l2=new Label("number 2");
l3=new Label("Result");
b1=new button ("Add");
b2=new button("multiply");
b3=new Button("Clear");
b4=new Button("Red");
b5=new Button("blue");
t1=new TextField("15");
t2=new TextField("15");
t3=new TextFieldss("15");
add(l1);
add(t1);
add(l2);
add(t2);
add(b1);
ad(b2);
add(b3);
add(l3);
add(t3);
add(b4);
add(b5);
b1.addActionListener(this);
b2.addActionlistener(this);
b3.addActionlistener(this);
b4.addActionListener(this);
b5.addActionListener(this);
SetBackground(Color.green);
}
public void actionPerformed(Action Event ae)
{
int n1,n2,n3;
if(ae.getSource()=b1)
{
n1=Integer.parseInt(t1.getText());
n2=Integer.parseInt(t2.getText());
n3=n1+n2
t3.SetText(String.value Of(n3));
}
if(ae.getSource()=b2)
{
n1=Integer.parseInt(t1.getText());
n2=Integer.parseInt(t2.getText());
n3=n1*n2;
t3.SetText(String value of(n3));
}
if(ae.getsource()==b3)
{
t1.SetText("");
t2.SetText("");
t3.SetText("");
}
if(ae.getSource()==b4)
{
SetBackground(Color.red);
}
if(ae.getSource()==b5)
{
SetBackground(Color.Blue);
}
}
}
/*<applet code=Applet67
 height=20 width=220>
</applet>
*/









































No comments:

Post a Comment