Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa Swing-AWT awt list item*
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


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



Advertisement
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 Tutorials/Questions & Answers:
Advertisements
Advertisements
 

 

 

DMCA.com