![]() ![]() ![]() |
|
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
Training Index
Using the List Componentby
Help
API Docs
About This Short Course
Short Course
Exercises
For this exercise you design an applet that displays a
PrerequisitesSkeleton CodeListFonts.java uses an API that was superceded with the Java 2 platform, version 1.2. Use ListFonts.java for version Java 1.1, or ListFonts2.java for Java 2 platform, version 1.2. Notice the changes in the code:
// version 1.1 String fontList[] = getToolkit().getFontList(); // version 1.2 GraphicsEnvironment env = GraphicsEnvironment.getLocalGraphicsEnvironment(); String fontList[] = env.getAvailableFontFamilyNames(); // version 1.1 list.addItem(fontList[i]); // version 1.2 list.add(fontList[i]);
Tasks
To receive the item events, add the applet itself as an
Define the
Where help exists, the task numbers above are linked to the step-by-step help page. Solution Source
Demonstration
This exercise only runs within browsers that support the Java Runtime Environment 1.1 and appletviewer. If you are using an appropriate browser, try this exercise. The output should look similar to the following:
Next ExerciseExercisesShort CourseCopyright 1996-2000 jGuru.com. All Rights Reserved. |