|
|
|
|
|
|
SolutionDownload ListTest source code.HTML Interface to Applet<APPLET CODEBASE="/applets/magelang/AWT-Training/classes/" CODE="ListTest.class" WIDTH=300 HEIGHT=90 ALIGN=CENTER></APPLET> Java Codeimport java.awt.*; public class ListTest extends java.applet.Applet { public void init() { String[] items = { "Red", "Orange", "Yellow", "Green", "Blue","Indigo", "Violet" }; MyList m = new MyList(5, items); add(m); } } class MyList extends List { public MyList(int displaySize, String[] elements) { super(displaySize, false); // no multiple selections for (int i=0; i<elements.length; i++) { addItem(elements[i]); } } } |