1 PR
1 PR
Program Code:
import java.awt.*;
import java.applet.*;
public class appletradiobutton extends Applet
{
Checkbox cb,cb1;
CheckboxGroup cbg;
public void init()
{
setLayout(new FlowLayout());
cb = new Checkbox("this is checkbox");
cbg= new CheckboxGroup();
cb1 = new Checkbox("this is radiobutton",false,cbg);
add(cb);
add(cb1);
}
}
/*
<applet code="appletradiobutton.java" width="500" height="500">
</applet>
*/
Output
import java.awt.*;
import java.applet.*;
public class TFTABLForm extends Applet
{
TextField tf;
TextArea ta;
Button b;
Label l1,l2;
public void init()
{
setLayout(new GridLayout(10,10));
l1 = new Label("Name:");
l2 = new Label("Address:");
tf =new TextField("enter name here");
ta =new TextArea("enter address here");
b = new Button("submit");
add(l1);
add(tf);
add(l2);
add(ta);
add(b);
}
}
/*
<applet code= TFTABLForm.java height="500" width="500">
</applet>
*/
Exercise:
import java.awt.*;
public class WELCOME extends Frame
{
Label l1;
WELCOME()
{
setLayout(new FlowLayout());
l1 = new Label("Welcome to java");
add(l1);
}
public static void main (String args[])
{
WELCOME w= new WELCOME();
w.setVisible(true);
w.setSize(500,500);
w.setTitle("WELCOME");
}
}
Output
__________________________________________
import java.awt.*;
public class MLang extends Frame
{
Checkbox cb1,cb2,cb3,cb4;
Label l1;
MLang()
{
setLayout(new FlowLayout());
l1= new Label("select language you know ");
3, Write a program to create three Buttons with Caption OK, RESET and
CANCEL.
import java.awt.*;