Java Reference
In-Depth Information
**17.19
( Display country flag and flag description ) Listing 17.4, ComboBoxDemo.java,
gives a program that lets users view a country's flag image and description
by selecting the country from a combo box. The description is a string coded
in the program. Rewrite the program to read the text description from a file.
Suppose that the descriptions are stored in the files description0.txt , . . ., and
description8.txt under the text directory for the nine countries Canada, China,
Denmark, France, Germany, India, Norway, the United Kingdom, and the
United States, in this order.
**17.20
( Slide show ) Programming Exercise 16.13 developed a slide show using images.
Rewrite that program to develop a slide show using text files. Suppose ten
text files named slide0.txt , slide1.txt , . . ., and slide9.txt are stored in the text
directory. Each slide displays the text from one file. Each slide is shown for one
second, and the slides are displayed in order. When the last slide finishes, the
first slide is redisplayed, and so on. Use a text area to display the slide.
**17.21
( Retrieve files from Web ) Write a Java program that retrieves a file from a Web
server, as shown in Figure 17.32. The user interface includes a text field in
which to enter the URL of the file name, a text area in which to show the file,
and a button that can be used to submit an action. A label is added at the bottom
of the applet to indicate the status, such as File loaded successfully or Network
connection problem .
F IGURE 17.32
The program displays the contents of a specified file on the Internet.
 
 
Search WWH ::




Custom Search