Java Reference
In-Depth Information
description8.txt
under the
text
directory for the nine countries Canada, China,
Denmark, France, Germany, India, Norway, United Kingdom, and United States,
in this order.
**16.28
(
Slide show
) Programming Exercise 15.30 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
direc-
tory. Each slide displays the text from one file. Each slide is shown for one sec-
ond, 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.
***16.29
(
Display a calendar
) Write a program that displays the calendar for the cur-
rent month. You can use the
Prior
and
Next
buttons to show the calendar of the
previous or next month. Display the dates in the current month in black and
display the dates in the previous month and next month in gray, as shown in
FigureĀ 16.48.
F
IGURE
16.48
The program displays the calendar for the current month.
**16.30
(
Pattern recognition: consecutive four equal numbers
) Write a GUI program for
Programming Exercise 8.19, as shown in FigureĀ 16.49a-b. Let the user enter the
numbers in the text fields in a grid of 6 rows and 7 columns. The user can click
the
Solve
button to highlight a sequence of four equal numbers, if it exists. Ini-
tially, the values in the text fields are filled with numbers from 0 to 9 randomly.
(a)
(b)
(c)
F
IGURE
16.49
(a-b) Clicking the
Solve
button highlights the four consecutive numbers in a row, a column, or a diagonal.
(c) The program enables two players to play the connect-four game.
Search WWH ::
Custom Search