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

Ajp PR2

Uploaded by

Vighnesh Pote
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)
24 views4 pages

Ajp PR2

Uploaded by

Vighnesh Pote
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.

2
Name: Pote Vighnesh Sandip Class: CO5I
Roll No: Batch: C

Title: Write a program to design a form using the components List and Choice.

1. Java Programs to show Seasons.


Program:
package Practical2;

import java.awt.*;
public class PR2_1
{
public PR2_1()
{
Frame f = new Frame("List Of seasons");
List l = new List(3,true);
l.add("Summer");
l.add("Winter");
l.add("Rainy");
f.add(l);
f.setSize(500,500);
f.setVisible(true);
f.setLayout(new FlowLayout());
}
public static void main(String[] args)
{
new PR2_1();
}
}

Output:
2. Java program to show subjects name.

Program:
package Practical2;

import java.awt.*;
public class PR2_2
{
public PR2_2()
{
Frame f = new Frame("List Of Subjects");
Label l1 = new Label("Select Subjects YouLike");
f.add(l1);
Choice c = new Choice();
c.add("Maths");
c.add("Physics");
c.add("Chemistry");
c.add("C++");
c.add("Java");
f.add(c);
f.setSize(500,500);
f.setVisible(true);
f.setLayout(new FlowLayout());
}
public static void main(String[] args)
{
new PR2_2();
}
}

Output:
3. Develop an applet/ application using List components to add names of 10 different cities.

Program:
package Practical2;

import java.awt.*;
public class PR2_3
{
public static void main(String args[])
{
Frame f = new Frame("List Of Cities");
Label l = new Label ("City");
f.add(l);
List lt = new List();
lt.add("Pune");
lt.add("Mumbai");
lt.add("Nashik");
lt.add("Nagpur");
lt.add("Ratnagiri");
lt.add("Dhule");
lt.add("Hydrabad");
lt.add("Banglore");
lt.add("Delhi");
lt.add("Amravati");
f.add(lt);
f.setSize(500,500);
f.setVisible(true);
f.setLayout(new FlowLayout());
}

Output:
4. Develop applet / application to select multiple names of news papers.

Program:
package Practical2;

import java.awt.*;

public class PR2_4


{
public PR2_4()
{
Frame f = new Frame("List Of News Papers");
List l = new List(4,true);
l.add("The Hindu");
l.add("Sakal");
l.add("Kesari");
l.add("Lokmat");
l.add("Pudhari");
f.add(l);
f.setSize(500,500);
f.setVisible(true);
f.setLayout(new FlowLayout());
}
public static void main(String args[])
{
new PR2_4();
}
}

Output:

You might also like