26.1* | ( Unicode viewer ) Develop an applet that displays Unicode characters, as shown in Figure 26.13. The user specifies a Unicode in the text field and presses the Enter key to display a sequence of Unicode characters starting with the specified Unicode. The Unicode characters are displayed in a scrollable text area of twenty lines. Each line contains sixteen characters preceded by the Unicode that is the code for the first character on the line. Figure 26.13. The applet displays the Unicode characters. |
26.2** | ( Displaying date and time ) Write a program that displays the current date and time as shown in Figure 26.14. The program enables the user to select a locale, time zone, date style, and time style from the combo boxes. Figure 26.14. The program displays the current date and time.
|
26.3 | ( Placing the calendar and clock in a panel ) Write an applet that displays the current date in a calendar and current time in a clock, as shown in Figure 26.15. Enable the applet to run standalone. Figure 26.15. The calendar and clock display the current date and time. |
26.4 | ( Finding the available locales and time zone IDs ) Write two programs to display the available locales and time zone IDs as shown in Figure 26.16. Figure 26.16. The program displays available locales and time zones using buttons . |
26.5* | ( Computing loan amortization schedule ) Rewrite Exercise 4.22 using an applet, as shown in Figure 26.17. The applet allows the user to set the loan amount, loan period, and interest rate, and displays the corresponding interest, principal, and balance in the currency format. Figure 26.17. The program displays the loan payment schedule. |
26.6 | ( Converting dollars to other currencies ) Write a program that converts U.S. dollars to Canadian dollars, German marks, and British pounds , as shown in Figure 26.18. The user enters the U.S. dollar amount and the conversion rate, and clicks the Convert button to display the converted amount. Figure 26.18. The program converts U.S. dollars to Canadian dollars, German marks, and British pounds.
|
26.7 | ( Computing loan payments ) Rewrite Listing 2.6, ComputeLoan.java, to display the monthly payment and total payment in currency. |
26.8 | ( Using the DecimalFormat class ) Rewrite Exercise 4.8 to display at most two digits after the decimal point for the temperature using the DecimalFormat class. |
26.9* | ( Using resource bundle ) Modify the example for displaying a calendar in §26.3.6, "Example: Displaying a Calendar," to localize the labels "Choose a locale" and "Calendar Demo" in French, German, Chinese, or a language of your choice. | ||
| |||
26.10** | ( Flag and anthem ) Rewrite Listing 16.13, ImageAudioAnimation.java, to use the resource bundle to retrieve image and audio files. Hint
|
26.11** | ( Specifying file encodings ) Write a program named Exercise26_11Writer that writes Chinese Unicode characters starting from \u0E00 to a file named Exercise26_11.gb using the GB18030 encoding scheme. Output sixteen characters per line and separate the characters with spaces. Write a program named Exercise26_11Reader that reads all the characters from a file using a specified encoding. Figure 26.19 displays the file using the GB18030 encoding scheme. Figure 26.19. The program displays the file using the specified encoding scheme. |