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:-