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

Design An Applet To Demonstrate Use of Radio Button and Checkbox Program:-Output

The document contains examples of Java applet programs that demonstrate using different GUI components like radio buttons, checkboxes, text fields, text areas, buttons, and labels. It also includes examples to create a grid layout and display numbers on buttons.

Uploaded by

sodagep4
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)
41 views4 pages

Design An Applet To Demonstrate Use of Radio Button and Checkbox Program:-Output

The document contains examples of Java applet programs that demonstrate using different GUI components like radio buttons, checkboxes, text fields, text areas, buttons, and labels. It also includes examples to create a grid layout and display numbers on buttons.

Uploaded by

sodagep4
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

1.

Design an applet to demonstrate use of Radio button and Checkbox

Program:- Output:-

import java.awt.*;
import java.applet.Applet;
public class Ex1_1 extends Applet{
public void init(){
setLayout(null);
Label l=new Label("Select Your language:");
l.setBounds(20,20,130,20);
add(l);
Checkbox a=new Checkbox("English");
a.setBounds(40,40,60,20);
add(a);
Checkbox b=new Checkbox("Hindi");
b.setBounds(40,60,90,20);
add(b);
Checkbox c=new Checkbox("Marathi");
c.setBounds(40,80,60,20);
add(c);
Label l1=new Label("Select Your Gender:");
l1.setBounds(20,110,130,20);
add(l1);
CheckboxGroup gen=new CheckboxGroup();
Checkbox d=new Checkbox("Male",gen,false);
d.setBounds(40,130,60,20);
add(d);
Checkbox e=new Checkbox("Female",gen,false);
e.setBounds(40,150,60,20);
add(e);
Button b1=new Button("Submit");
b1.setBounds(20,180,60,20);
add(b1);
}
}
/*<applet code="Ex1_1.class" height="500"
width="500"></applet>*/
2. Design an applet to create form using text field, text area, button and label

Program:- Output:-

import java.awt.*;
import java.applet.Applet;
public class Ex1_2 extends Applet{
public void init(){
setLayout(null);
Label l=new Label("Enter Name:");
l.setBounds(40,20,80,20);
add(l);
TextField t=new TextField();
t.setBounds(40,40,120,25);
add(t);
Label l1=new Label("Enter Address:");
l1.setBounds(40,70,90,20);
add(l1);
TextArea t1=new TextArea();
t1.setBounds(40,90,140,80);
add(t1);
Button b=new Button("Submit");
b.setBounds(40,180,60,30);
add(b);
}
}
/*<applet code="Ex1_2.class" height="500"
width="500"></applet>*/

1. Write java program to show following output

Program:- Output:-

import java.awt.*;
import java.applet.Applet;
public class Ex2_1 extends Applet{
public void init(){
List l=new List();
l.add("Summer");
l.add("Winter");
l.add("Rainy");
l.add(" ");
add(l);
}
}
/*<applet code="Ex2_1.class" height="500"
width="500"></applet>*/
1. Write java program to demonstrate grid of 5*5

Program:- Output:-

import java.awt.*;
import java.applet.Applet;
public class Ex3_1 extends Applet{
public void init(){
setLayout(new GridLayout(5,5,2,2));
add(new Button("A"));
add(new Button("B"));
add(new Button("C"));
add(new Button("D"));
add(new Button("E"));
add(new Button("F"));
add(new Button("G"));
add(new Button("H"));
add(new Button("I"));
add(new Button("J"));
add(new Button("K"));
add(new Button("L"));
add(new Button("M"));
add(new Button("N"));
add(new Button("O"));
add(new Button("P"));
add(new Button("Q"));
add(new Button("R"));
add(new Button("S"));
add(new Button("T"));
add(new Button("U"));
add(new Button("V"));
add(new Button("W"));
add(new Button("X"));
add(new Button("Y"));
}
}
/*<applet code="Ex3_1.class" height="500"
width="500"></applet>*/
2. Write a program to display the numbers on button from 0-9

Program:- Output:-

import java.awt.*;
import java.applet.Applet;
public class Ex3_2 extends Applet{
public void init(){
setLayout(new GridLayout(2,2,2,2));
add(new Button("0"));
add(new Button("1"));
add(new Button("2"));
add(new Button("3"));
add(new Button("4"));
add(new Button("5"));
add(new Button("6"));
add(new Button("7"));
add(new Button("8"));
add(new Button("9"));
}
}
/*<applet code="Ex3_2.class" height="500"
width="500"></applet>*/

You might also like