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>
*/
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