answersLogoWhite

0

How can create choice list in java?

User Avatar

Anonymous

12y ago
Updated: 8/18/2019

import java.awt.*;
import java.awt.event.*;
public class ChoiceOptionExample{
public static void main(String[] args) {
Frame frame=new Frame("Choice");
Label label=new Label("What is your Choice:");
Choice choice=new Choice();
frame.add(label);
frame.add(choice);
choice.add("ROSE");
choice.add("India");
choice.add("WELCOME");
frame.setLayout(new FlowLayout());
frame.setSize(250,150);
frame.setVisible(true);
frame.addWindowListener(new WindowAdapter(){
public void windowClosing(WindowEvent e){
System.exit(0);
}
});
}
}

User Avatar

Wiki User

12y ago

What else can I help you with?