The applet should have a button. When the user clicks on the button, the applet should count the number of lines in the user's input, the number of words in the user's input, and the number of characters in the user's input. This information should be displayed on three labels in the applet. This function returns a String containing all the text from the TextArea . The number of characters is just the length of this String .
Words are a little harder to count.
Exercise 3.4 has some advice about finding the words in a String . Essentially, you want to count the number of characters that are first characters in words. The RGBColorChooser applet lets the user set the red, green, and blue levels in a color by manipulating scroll bars. Something like this could make a useful custom component. Such a component could be included in a program to allow the user to specify a drawing color, for example.