CIS 27P

Java For Programmers

Homework #4

Due: 8/09/2001

 

 

Assignment

 

Write a Java applet that named Alphabetizer.? It should contain a text field and a submit button.? When the user types in a string in the text field and clicks Submit, the applet should add that string to a list displayed below the components.? The list should always be displayed in alphabetical order, regardless of the order that the strings were entered.? The entries submitted by the user should be stored in a Collections class and duplicate entries should not be displayed multiple times.? Do not worry about entries that are too long getting cut off on the right side of the applet, or lists that are too long scrolling off the bottom of the applet.? Your applet should be at least large enough to support at least 10 entries when viewed with the applet viewer.

 

Make sure your applet works with the JDK 1.3.1 appletviewer application and put the <APPLET> HTML tag at the top of your source code.

 

Notes

 

Your diskette should have only those files pertaining to Homework #4.? Your applet? should be in the default package (using no package declaration.)? Put your ?.java? file(s) in the root of the diskette.? The following command sequence must be able to run your application:

a:

appletviewer Alphabetizer.java

 

IMPORTANT: This assignment will not be accepted after the due date.? It must be turned in before class the day of the final exam.

 

 


Sample

 

The following figure shows what the applet should look like after ten strings are entered in random alphabetical order: