You are on page 1of 4

Advance Java Programming

---------------------------------------------------------------------------
Name :- AyushMaroti Wadje Class :-CO5I
Roll No :- 75
------------------------------------------------------------------------------------------------
Practical No 2 :- Write a program to design a form using the components
List and Choice
X. --------- ?
1. Write a Program to show following output.

Code :-
import java.awt.*;
class season
{
public static void main(String args[])
{
Frame fr = new Frame(" My Applet Viewer:");
fr.setSize(350,400);
fr.setVisible(true);
fr.setLayout(new FlowLayout());
List l1 = new List(3,false);
Label l2 = new Label("Applet");
l1.add("Window");
l1.add("Mac");
l1.add("linux");
fr.add(l2);
fr.add(l1);
}
}

output:-
XIII. Exercise.
1. Develop an applet/applications using List components to add names of 10
different cities.
Code :-
import java.awt.*;
class cities
{
public static void main(String args[])
{
Frame fr = new Frame(" Java Practical 2 ");
fr.setSize(350,300);
fr.setVisible(true);
fr.setLayout(new FlowLayout());
List l1 = new List(10,false);
Label l2 = new Label("Cities:");
l1.add("Mumbai");
l1.add("Chennai");
l1.add("bangalore");
l1.add("kolkata");
l1.add("Jaipur");
l1.add("Nanded");
l1.add("Surat");
l1.add("Lucknow");
l1.add("Pune");
l1.add("Indore");
fr.add(l2);
fr.add(l1);
}
}

Output :-
2. Develop applet/application to select multiple names of news papers.
Code :-
import java.awt.*;
class news_papers
{
public static void main(String args[])
{
Frame fr = new Frame(" Java Practical 2 ");
fr.setSize(350,300);
fr.setVisible(true);
fr.setLayout(new FlowLayout());
List l1 = new List(4,false);
Label l2 = new Label("Select News Papers : ");
l1.add("All Time India");
l1.add("The Hindu");
l1.add("Hindustan times");
l1.add("The New york Time ");
l1.add("The Independent" );
fr.add(l2);
fr.add(l1);

}
}
Output :-

You might also like