0% found this document useful (0 votes)
16 views2 pages

Pratical 2

The document presents a Java program that creates a graphical user interface (GUI) form using AWT components. It includes a list for selecting sweets and a choice dropdown for selecting shakes. The program sets up the frame, labels, list, and choice components, and makes the frame visible with a specified size and layout.

Uploaded by

snehatumaskar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views2 pages

Pratical 2

The document presents a Java program that creates a graphical user interface (GUI) form using AWT components. It includes a list for selecting sweets and a choice dropdown for selecting shakes. The program sets up the frame, labels, list, and choice components, and makes the frame visible with a specified size and layout.

Uploaded by

snehatumaskar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Practical No.

2
Aim:- Write a program to design a form using the components List and Choice

Program :-

import java.awt.*;
public class LISTCHOICE
{
public static void main(String args[])
{
Frame f = new Frame("LISTCHOICE");
Label label = new Label("Select the sweet : ");
List l = new List();
l.add("Chocolate");
l.add("Icecream");
l.add("Waffles");
l.add("Kheer");
l.add("Kalakand");

Label L = new Label("Select the Shake : ");


Choice c = new Choice();
c.add("Milk Shake");
c.add("Chocolate Shake");
c.add("Chocochip Shake");
c.add("Stawberry Shake");
c.add("Vanilla Shake");

f.add(label);
f.add(l);
f.add(L);
f.add(c);

f.setVisible(true);
f.setSize(400,400);
f.setLayout(new FlowLayout());
}
}
Output:-

You might also like