Tuesday, February 16, 2016

Program to add choice menu in Frame.

import java.awt.*;
class Choice_Test extends Frame
{
public static void main(String arg[])
{
Choice ch = new Choice ( );
ch.add ( "Apples" );
ch.add ( "Oranges" );
ch.add ( "Strawberries" );
ch.add ( "Bananas");
Choice_Test f1=new Choice_Test();
f1.setTitle("Adding a Choice menu in a Frame!!!");
f1.setLayout(new FlowLayout());
f1.add(ch);
f1.setSize(500,300);
f1.setVisible(true);
}
}
Output:


No comments:

Post a Comment