Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
13 views3 pages

Java Practical2

Uploaded by

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

Java Practical2

Uploaded by

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

Name:- Priyanka Khandu Thadke

Class:-A(CO5I) Roll no:- 60


Practical no:-02 Write a program to design a form using the components List and Choice.

Exercise:-
Q.1)Develop an applet/application using List Components to add names of 10 different cities.
Program:-

/*<applet code="City.java" width=300 height=100></applet>*/

import java.awt.*;

import java.applet.*;

public class City extends Applet

List l;

Label lb;

public void init()

l= new List(10,true);

l.add("Nanded");

l.add("Pusad");

l.add("Loha");

l.add("Solapur");

l.add("Mumbai");

l.add("Latur");

l.add("Pune");

l.add("Umerkhed");

l.add("yvatmal");
l.add("Nagpur");

lb=new Label("select The City");

add(lb);

add(l);

public void paint(Graphics g)

}
}
Output:-

Q.2)Develop Applet/Application to select multiple names of news Papers.

Program:-

/*<applet code="NewsPaper.java" width=300 height=100></applet>*/

import java.awt.*;

import java.applet.*;

public class NewsPaper extends Applet

List l;

Label lb;
public void init()

l= new List(7,true);

l.add("Times of India");

l.add("Pudhari");

l.add("Lokmat");

l.add("Sakal");

l.add("Mumbai Times");

l.add("Loksatta");

l.add("Today's Times");

lb=new Label("select The newsPaper");

add(lb);

add(l);

public void paint(Graphics g)

Output:-

You might also like