Ajp Exp 2 Op
Ajp Exp 2 Op
Practical Code:
1. Write Java Program to show the give output (Refer Manual pg. no. 7) :
import java.awt.*;
public class ListDemo{
public static void main(String[] args) {
Frame f1 = new Frame("Exp 2");
f1.setLayout(new GridLayout(12,1));
Label n2 = new Label("Choose your favourite Season: ");
List l1 = new List(3, false);
l1.add("Summer");
l1.add("Winter");
l1.add("Rainy");
l1.add("Autumn");
l1.add("Spring");
f1.add(n2);
f1.add(l1);
f1.setVisible(true);
f1.setSize(400, 300);
}
}
XIII Exercise:
1. Develop an applet/ application using List components to add names of 10 different cities
import java.awt.*;
import java.net.*;
import java.util.Date;
public class RadioButtonDemo{
public static void main(String[] args) {
Frame f1 = new Frame("Exp 2");
f1.setLayout(new GridLayout(12,1));
Label n2 = new Label("Choose your City: ");
List l1 = new List(10, false);
l1.add("Mumbai");
l1.add("Delhi");
l1.add("Pune");
l1.add("Patna");
l1.add("Kolkata");
l1.add("Chennai");
l1.add("Bengaluru");
l1.add("Amritsar");
l1.add("Mirzapur");
l1.add("Nagpur");
f1.add(n2);
f1.add(l1);
f1.setVisible(true);
f1.setSize(400, 300);
}
}
2. Develop applet / application to select multiple names of news papers.
import java.awt.*;
import java.net.*;
import java.util.Date;
public class RadioButtonDemo{
public static void main(String[] args) {
Frame f1 = new Frame("Exp 2");
f1.setLayout(new GridLayout(12,1));
Label n2 = new Label("Choose your Favourite Newspaper: ");
Choice l1 = new Choice();
l1.add("Times of India");
l1.add("Hindustan Times");
l1.add("Mid-Day");
l1.add("The Economic Times");
f1.add(n2);
f1.add(l1);
f1.add(n1);
f1.add(n);
f1.add(d);
f1.add(i);
f1.setVisible(true);
f1.setSize(400, 300);
}
}