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

Practical No. 2

Uploaded by

ganeshkumbhar638
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)
8 views3 pages

Practical No. 2

Uploaded by

ganeshkumbhar638
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

 Write a Program to show following output.

Code :
import java.awt.*;
import java.awt.event.*;

public class P2b extends Frame {


P2b() {
List l = new List();
l.add("Summer");
l.add("Winter");
l.add("Rainy");
l.setBounds(50,50,100,100);
add(l);
setSize(500, 500);
setLayout(null);
setVisible(true);
}

public static void main(String[] args) {


new P2b();
}
}

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

import java.awt.*;
import java.awt.event.*;

public class P2e1 extends Frame {


P2e1() {
List l = new List();
l.add("Kolhapur");
l.add("Pune");
l.add("Mumbai");
l.add("Amravti");
l.add("Thane");
l.add("Satara");
l.add("Sangli");
l.add("Karad");
l.add("Solapur");
l.add("Dhule");
l.setBounds(50,50,150,200);
add(l);
setSize(500, 500);
setLayout(null);
setVisible(true);
}
public static void main(String[] args) {
new P2e1 ();
}
}

Output :

Q2. Develop applet/ application to select multiple names of newspapers.


import java.awt.*;
import java.awt.event.*;
public class P2e2 extends Frame {
P2e2() {
List l = new List(5,true);
l.add("The Hindu");
l.add("Tarun Bharat");
l.add("Pudari");
l.add("The Times of India");
l.add("Hindustan");
l.add("Lokamat");
l.add("Sakal");
l.setBounds(50,50,150,80);
add(l);
setSize(500, 500);
setLayout(null);
setVisible(true);
}

public static void main(String[] args) {


new P2e2 ();
}
}

Output :

You might also like