Pages

Java Tutorials

Java Tutorials
Java Tutorials

Wednesday, 6 November 2013

Simple program to add buttons in Applet

import java.applet.*;
import java.awt.*;
public class web6 extends Applet
{
Label l1,l2,l3;
TextField t1,t2,t3;
Button b1,b2,b3,b4;
public void init()
{
l1=new Label("Enter first no");
l2=new Label("Enter second no");
l3=new Label("Results");
t1=new TextField(5);
t2=new TextField(5);
t3=new TextField(5);
b1=new Button("Add");
b2=new Button("Substration");
b3=new Button("Multiply");
b4=new Button("New");
add(l1);
add(t1);
add(l2);
add(t2);
add(l3);
add(t3);
add(b1);
add(b2);
add(b3);
add(b4);
}
public void paint(Graphics g)
{
g.drawString("Desinged by Abhishek kesharwani",100,300);
}
}
/*
<applet code=web6 width=300 height=300>
</applet>
*/

No comments:

Post a Comment