O'Reilly logo

Graphic Java™ 1.2, Volume I: AWT, Third Edition by David M. Geary

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

java.awt.TextComponent

TextField and TextArea both extend the TextComponent class. TextComponent, as a matter of fact, exists solely to provide fundamental text editing capabilities for TextArea and TextField.

As evidenced by the class diagram in Figure 14-1, TextComponent provides the following functionality:

Figure 14-1. TextComponent Class Diagram. TextComponent maintains text, selection range, and editability of the component. TextComponent cannot be instantiated by classes outside the java.awt package.

  • Get and set text

  • Get and set selected text

  • Get and set editable mode

  • Position the insertion caret[2]

    [2] Since caret manipulation is handled by ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required