WRITE A PROGRAM TO DESIGN A FORM USING THE COMPENENT LIST AND CHOICE
Program Code :
1. Write Java Program to show following output.
Write a program to design a form using the components List and Choice. |
OUTPUT :
import java.awt.*;
/**
*
* @author Total Programming
*/
public class programcode1 {
programcode1()
{
Frame frame = new Frame();
frame.setLayout(new FlowLayout());
List list = new List(4);
list.add("Summer");
list.add("Winter");
list.add("Rainy");
frame.add(list);
frame.setSize(500, 500);
frame.setVisible(true);
}
public static void main(String args[]) {
programcode1 pr1 = new programcode1();
}
}
EXERCISE :-
1) Develop an applet/ application using List components to add names of 10 different cities.
import java.awt.*;
public class exercise11 {
exercise11()
{
Frame frame = new Frame();
frame.setLayout(new FlowLayout());
List list = new List(5,false);
list.add("Select your city");
list.add("Los Angles");
list.add("Pune");
list.add("Dhule");
list.add("Thane");
list.add("Satara");
list.add("Nashik");
list.add("Nagpur");
frame.add(list);
frame.setSize(500, 500);
frame.setVisible(true);
}
public static void main(String args[]) {
exercise11 ex11 = new exercise11();
}
}
OUTPUT
Develop an applet/ application using List components to add names of 10 different cities. |
2) Develop applet / application to select multiple names of news papers
import java.awt.*;
/**
*
* @author chetan
*/
public class exercise12 {
exercise12()
{
Frame frame = new Frame();
frame.setLayout(new FlowLayout());
List list = new List(4);
list.add("Select your favourite newspaper");
list.add("Sakal");
list.add("Hindu");
list.add("Times of Ondia");
list.add("Lokmat");
list.add("Pudhari");
frame.add(list);
frame.setSize(500, 500);
frame.setVisible(true);
}
public static void main(String args[]) {
exercise12 ex12 = new exercise12();
}
}
OUTPUT
Develop applet / application to select multiple names of news papers |