0% found this document useful (0 votes)
5 views4 pages

Ajp Prac 1

Uploaded by

saeedarwatkar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views4 pages

Ajp Prac 1

Uploaded by

saeedarwatkar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Practical No.

 Program code:

1. Design an applet/application to demonstrate the use of Radio Button and


Checkbox.

import java.awt.*;
class prac1_saee
{
public static void main(String args[])
{
Frame f=new Frame();
f.setLayout(new FlowLayout());
f.setVisible(true);
f.setSize(400,400);

CheckboxGroup cbg=new CheckboxGroup();

Checkbox cb1=new Checkbox ("Female",cbg,true);


Checkbox cb2=new Checkbox ("Male",cbg,false);

Checkbox c1=new Checkbox("Pune");


Checkbox c2=new Checkbox ("Nagpur");
Checkbox c3=new Checkbox ("Solapur");
Checkbox c4=new Checkbox ("Mumbai",true);

f.add(c1);
f.add(c2);
f.add(c3);
f.add(c4);

f.add(cb1);
f.add(cb2);

}
}
Output:

2. Design an applet/application to create form using Text Field, Text


Area, Button and Label.

import java.awt.*;
class exp1_saee1
{
public static void main(String args[])
{
Frame f=new Frame();
f.setLayout(new FlowLayout());
f.setVisible(true);
f.setSize(400,400);
f.setTitle("exp1_saee1");
Label l1=new Label("UserName");
Label l2=new Label("Password");
TextField t1=new TextField(20);
TextField t2=new TextField(20);
t2.setEchoChar('*');
TextArea ta=new TextArea(10,30);
Button b1=new Button ("Submit");
f.add(l1);
f.add(t1);
f.add(l2);
f.add(t2);
f.add(ta);
f.add(b1);
}
}
Output :

 Exercise :

1. Write a program to demonstrate Label, Button and Checkbox and its


method.

/*<applet code="saee_exp1" width=500


height=500></applet>*/ import java.applet.*;
import java.awt.*;
public class saee_exp1 extends Applet
{
public void init()
{
Checkbox cb1=new
Checkbox("Marathi"); Checkbox
cb2=new Checkbox("English");
Checkbox cb3=new Checkbox("Hindi");
Checkbox cb4=new
Checkbox("German"); Checkbox
cb5=new Checkbox("Spanish");
Checkbox cb6=new
Checkbox("French"); Checkbox
cb7=new Checkbox("Russian"); Label
l1=new Label("WELCOME TO JAVA");
Button b1=new Button("OK");
Button b2=new
Button("RESET"); Button
b3=new Button("CANCEL");
add(l1);
add(cb1);
add(cb2);
add(cb3);
add(cb4);
add(cb5);
add(cb6);
add(cb7);
add(b1);
add(b2);
add(b3);
}
}

Output:

You might also like