Home Answers Viewqa Swing-AWT awt list item*

 
 


lizhengchen
awt list item*
1 Answer(s)      4 years and 7 months ago
Posted in : Swing AWT

View Answers

November 14, 2008 at 11:12 PM


Hi friend,


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

public class ChoiceListDemo{
public static void main(String[] args) {
Frame frame=new Frame("Add list");
Label label=new Label("What is your Choice:");
Choice choice=new Choice();
frame.add(label);
frame.add(choice);
choice.add("Java ");
choice.add("Jsp");
choice.add("Servlets");
choice.add("HTML");
choice.add("JavaScript");
choice.add("JSF");
choice.add("Struts");
List lst = new List(4, false);
lst.add("Books");
lst.add("Venus");
lst.add("Earth");
lst.add("JavaSoft");
lst.add("Mars");
lst.add("Jupiter");
lst.add("Saturn");
lst.add("Welcome");
lst.add("Delhi");
lst.add("Rose");
frame.add(lst);

frame.setLayout(new FlowLayout());
frame.setSize(250,150);
frame.setVisible(true);
frame.addWindowListener(new WindowAdapter(){
public void windowClosing(WindowEvent e){
System.exit(0);
}
});
}
}

--------------------------------

Visit for more information.

http://www.roseindia.net/java/example/java/awt/

Thanks.









Related Pages:

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.