Chapter 13
The exercises here are taken from my forthcoming book,
The Java Developer's Resource.
Quiz
- What's the difference between reloading and restarting an applet?
Exercises
- The typewriter applet is really very basic. Try to spruce it up enough to pass as a simple word processor. This exercise is fairly open ended. Possibilities include
- A data structure that can handle arbitrary amounts of text
- Break for word wrapping on spaces
- Insert a blinking vertical bar at the position of the insertion point
- Dynamically adjust the text flow based on the size of the window and the size of the font
- Handle the delete key
- Use the mouse to position the insertion point
- An insert mode as well as the current typeover mode
- Set the font to Courier
- Clean up the (by now quite messy) keyDown method by breaking it up into smaller pieces. Try creating a cursor object that responds to moveLeft, moveRight, moveTo(), and other such messages.
Don't get too wrapped up in this though. You'll see in Chapter 15 that Java does provide a TextArea class that gives you all this functionality, essentially for free.
[ Exercises | Cafe Au Lait |
Books |
Trade Shows |
Links | FAQ |
Tutorial |
User Groups ]
Copyright 1996 Elliotte Rusty Harold
elharo@sunsite.unc.edu
Last Modified August 20, 1996