103 Add Control TextField and Button on Applet in Java

Code:

import java.util.*;
import java.applet.*;
import java.awt.*;

public class Control extends Applet
{
TextField t1;
Button b1;

public void init()
{
t1 = new TextField(20);
b1 = new Button("Click");

setBackground(Color.magenta);
add(t1);
add(b1);
}
}

/*
<applet code="Control" width=300 height=300>
</applet>
*/




Ouput:



Previous
Next Post »